Nginx location for not exists php files

I have config(minimal):

server {
listen test.local:80;
server_name test.local;

server_name_in_redirect off;

location / {
root /data/www/test/public;
try_files $uri $uri/ /index.php?route=$uri&$args;
index index.html index.php;
}

location ~ .php$ {
root /data/www/test/public;

fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;

fastcgi_param  SCRIPT_FILENAME

/data/www/test/public$fastcgi_script_name;
fastcgi_param …

}
}
Thats work file for urls /help/ or /contacts/ etc(all redirect to
index.php
with get variabled).

But if url, for example, /help.php or contacts.php, and this files not
exists, i have output

File not found.
How update my nginx config? I need urls, for example:

/help.php => /index.php?route=/help.php
/contacts.php?foo=bar… =>
/index.php?route=/contacts.php&args=…
Thanks a lot!

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

On Thu, Jun 12, 2014 at 08:51:32AM -0400, Khmelevsky wrote:

Hi there,

But if url, for example, /help.php or contacts.php, and this files not
exists, i have output

File not found.
How update my nginx config? I need urls, for example:

Untested, but:

put

try_files $uri /index.php?route=$uri&$args;

inside the php location, and see if that changes anything.

f

Francis D. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs