Nginx location for not exists php files

Khmelevsky nginx-forum at
Thu Jun 12 12:51:32 UTC 2014

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_index index.php;

    fastcgi_param  SCRIPT_FILENAME  
    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:,250818,250818#msg-250818

More information about the nginx mailing list