Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx fastcgi_index index.php not working

Tags:

php

nginx

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.

like image 492
hanji Avatar asked Dec 05 '25 18:12

hanji


1 Answers

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

like image 71
jedifans Avatar answered Dec 08 '25 08:12

jedifans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!