Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

REST URLs and NGINX (config help needed) (1 reply)

$
0
0
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

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>