nginx: try_files not finding static files, falling back to PHP

Posted by Wells Oliver on Server Fault See other posts from Server Fault or by Wells Oliver
Published on 2013-10-22T18:10:19Z Indexed on 2013/10/23 3:57 UTC
Read the original article Hit count: 347

Filed under:

Relevant configuration:

location /myapp {
    root /home/me/myapp/www;
    try_files $uri $uri/ /myapp/index.php?url=$uri&$args;

    location ~ \.php {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include       /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    }
}

I absolutely have a file foo.html in /home/me/myapp/www but when I browse to /myapp/foo.html it is handled by PHP, the final fallback in the try_files list.

Why is this happening?

© Server Fault or respective owner

Related posts about nginx