REST URLs and NGINX (config help needed)

Ben ben+nginx at
Tue Jun 14 17:28:55 UTC 2016


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

	location /demo {
		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 returns the hello-world output 
from my PHP router. No problems there.

But, if I call, say,, 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 ?

More information about the nginx mailing list