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 have a simple nginx config that used to pass all requests to /site/index.php. After upgrading to ubuntu 12.04 this config doesn't work anymore.

server {
    listen   80;
    server_name site.com;
    root /site/;
    access_log  /var/log/nginx/site.log;

    location / {
             fastcgi_pass    127.0.0.1:9000;
             fastcgi_index   index.php;
             fastcgi_param   SCRIPT_FILENAME /site/index.php;
             include         fastcgi_params;
    }
}

The rule fastcgi_param SCRIPT_FILENAME /site/index.php; used to send everything matching 'location /' to index.php but now instead I get a 404 error.

This works

  • site/index.php

This doesn't

  • site
  • site/folder

Any ideas ?

share|improve this question

migrated from webmasters.stackexchange.com Aug 22 '12 at 10:36

This question came from our site for pro webmasters.

    
Does the nginx error log contain any errors? (It should be available under Ubuntu by doing sudo cat /var/log/nginx/error.log) –  Nick Aug 22 '12 at 9:52

1 Answer 1

You don't have an index specified in your config, try the next config instead:

server {
    listen   80;
    server_name site.com;
    root /site/;
    access_log  /var/log/nginx/site.log;

    location / {
             index index.php index.html;
     }

    location ~ \.php$ {
             fastcgi_pass    127.0.0.1:9000;
             fastcgi_index   index.php;
             fastcgi_param   SCRIPT_FILENAME /site/index.php;
             include         fastcgi_params;
    }
}
share|improve this answer

Your Answer

 
discard

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.