File not found "location issue"?

Rich asked:

I’m stuck with a File Not Found issue with Nginx and FastCGI for PHP. Could someone have a look at my conf file?

server {

        listen   80; ## listen for ipv4
        listen   [::]:80 default ipv6only=on; ## listen for ipv6

        server_name  localhost;

        access_log  /var/log/nginx/localhost.access.log;

        root   /var/www/site1;
        location / {
                index  index.html index.htm;

        location ~ \.php$ {
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
        include fastcgi_params;

        location /doc {
                root   /usr/share;
                autoindex on;
                deny all;

        location /images {
                root   /usr/share;
                autoindex on;


My answer:

One of your fastcgi_params is wrong.

It should read:

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.