hanji hanji - 3 months ago 7
PHP Question

Nginx fastcgi_index index.php not working

I'm working on setting up a development environment, but for some reason the fastcgi_index is not working. The difference between the production and dev environment is the listening port of nginx. Other than that, it's the same. In production, it's 80, and on dev it's 8080.

When I go to http://domain.com:8080, I get Forbidden 403 forbidden. If I put index in there, I get the file ie: http://domain.com:8080/index.php

Directory permission is 755 and index.php is readable by everyone. I don't think it's a permission issue since navigating directly to the file works.

This is what I have in the conf:

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi.conf;
fastcgi_read_timeout 180;
}


My guess it has to do something with the port 8080? Again, that should be the only difference between the 2 servers.

Answer

Have you declared root /index.php at server level?