Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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_index  index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include        fastcgi_params;
share|improve this question
up vote 3 down vote accepted

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

share|improve this answer

php-cgi on Windows has a bug concerning relative paths apparently:

[PHP-BUG] Bug #54955 [NEW]: FastCGI doesn't recognize Windows relative paths

Your solutions are:

  1. Absolute paths like what Michael Hampton said.
  2. Junctions.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.