Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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;
}
share|improve this question
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.