If this is sometimes working (so you know PHP-FPM is up and working), I'd be pretty set on this being a nginx issue. I'm suspicious of a couple of the rules in your PHP location block. They might be breaking in certain URLs causing nginx to dump out.
You only need 2 lines for catching directory indexes:
location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; }
Strip that location back to that, reload nginx and see what happens.
If you need rewriting (pretty URLs in Wordpress, etc) you want to add something like this
location / { try_files $uri $uri/ /index.php?$args; }
But only do that once you've got standard URLs working.
manpreet
Best Answer
2 years ago
I know this is a popular question but I haven't found anyone with my similar issue. I can serve PHP files as long as the .php extension is not in the url. For example:
If I go to
localhost
I am served my index.php file. If I go tolocalhost/index.php
I download the file. Here is my config:I am quite confused by this issue and I am wondering if anyone has experience in the matter.