Welcome! Log In Create A New Profile

Advanced

REST URLs and NGINX (config help needed)

Ben
June 14, 2016 01:30PM
Hi,

Based on scraps found in the NGINX docs, I have a semi-working config
that looks as follows :

#####
location /demo {
allow 10.0.0.0/8;
deny all;
try_files $uri @pdemo;
}
location @pdemo {
fastcgi_param SCRIPT_FILENAME /path/to/demo.php;
fastcgi_param SCRIPT_NAME /demo.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param QUERY_STRING $args;
include fastcgi_params;
}

#####


I say this config is "semi-working" because :

A base-call to http://example.com/demo returns the hello-world output
from my PHP router. No problems there.

But, if I call, say, http://example.com/demo/hello/x, the PHP router
doesn't match the route (despite expecting hello/x as the path).

If it helps, I'm using bramus router and my configured paths are as
follows :

$router->get('/', function() { echo "hello world"};
$router->get('hello/(\w+)', function($name) {echo "hello".$name};

However bramus returns a 404, and it doesn't matter if I prefix the
hello path with a forwad slash in bramus.

Therefore I am guessing my nginx config is broken ?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

REST URLs and NGINX (config help needed)

Ben June 14, 2016 01:30PM

Re: REST URLs and NGINX (config help needed)

Edho Arief June 14, 2016 02:10PM

Re: REST URLs and NGINX (config help needed)

Ben June 16, 2016 09:08AM

Re: REST URLs and NGINX (config help needed)

Edho Arief June 16, 2016 09:12AM

Re: REST URLs and NGINX (config help needed)

Edho Arief June 16, 2016 09:16AM

Re: REST URLs and NGINX (config help needed)

Ben June 16, 2016 09:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 159
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready