Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script that is being access via a URL like this:


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
location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    # With php5-cgi alone:
    # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
share|improve this question

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:

 location ~ \.php/ {
     fastcgi_split_pathinfo ^(.*\.php)(/.*)$;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.