Replacing the php regex with try_files?

TECK nginx-forum at nginx.us
Fri Dec 17 10:08:25 MSK 2010


Hi all,

Right now I use this type of configuration:
[code]
        location / {
                try_files               $uri $uri/
/index.php?q=$uri&$args;
        }
        location ~ \.php$ {
                fastcgi_pass            127.0.0.1:9000;
                include                 fastcgi.conf;
        }
[/code]

My goal is to eliminate the regex on php file names:
[code]
        location / {
                try_files               $uri $uri/ @php;
        }
        location @php {
                try_files               $uri.php /index.php?q=$uri&$args
/404.html;
                fastcgi_pass            127.0.0.1:9000;
                include                 fastcgi.conf;
        }
[/code]

I'm not sure if this is the correct way to do it. Any suggestions are
welcome.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,159307,159307#msg-159307




More information about the nginx mailing list