No input file specified on nginx and php-cgi

Sandeep Bansal asked:

I’m trying to run nginx and php-cgi on my Windows PC, I’ve got up to the point where I want to move the html directory back two directory’s so I can sort of create a structure.

The only problem I have now is that PHP doesn’t pick up any .php file. I have tried loading a static html file (localhost/test.html) and it works fine but localhost/info.php doesn’t work at all.

Can anyone give me some guidance on this? The part of the server block can be found below.

server {
        listen       80;
        server_name  localhost;
        root   ../../www;
        index  index.html index.htm index.php;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location ~ .php$ {
          fastcgi_pass   127.0.0.1:9123;
          fastcgi_index  index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include        fastcgi_params;
        }

My answer:


Don’t use a relative path in the root directive. Use the absolute path.


View the full question and answer on Server Fault.

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