I have a script that is being access via a URL like this:
/directory/file.php/methodName
I need nginx to handle this specific route and send it to PHP. Right now my config currently just catches anything ending in .php and sends it to PHP. How can I tweak my config to handle the case above as well?
Here is my nginx block:
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
Your fastcgi_split_pathinfo will not do anything, cause the location does not contain a slash and is anchored at the match end. Use a location like this: