Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 3 down vote accepted

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

share|improve this answer
add comment

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.