File not found NGINX

Posted June 5, 2018 10.6k views
NginxPHPUbuntu 16.04

One website that is hosted on a server I recently increased php to 7.2, If I had known the issues this would cause I might have not started but hey ho!

So I have 3 sites sharing this VPS. The other 2 are working fine. And the one that was not working momentarily appeared to be working as I saw all the warning all the sites gave me as php broke the old php code (was not 7.2 compatible).

For some reason however I get simple file not found message on the screen. So searching yesterday I found some posts but most all were nothing useful.
I think I have checked the correct user. Will php user be changed somehow?

So I also get this for the sitemap.xml file so it’s not looking related to the php for me..

My server block for the php is

location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @landed,

The Not Found message shouldn’t be connected to the PHP. Usually a 404 error is a result of not using the proper location for your website files.

Now I didn’t fully understand if you get 404 Not Found as a server error code or from your application. If it’s from your application, I’ll recommend checking your error log /var/log/nginx/error.log.

Additionally, please confirm PHP is actually in the mentioned directories fastcgi_pass unix:/run/php/php7.2-fpm.sock;. To do so type in

whereis php

Once you find it, replace the path in your location block with the one you have now.