Suddenly your whole WordPress website may show Nginx 404 errors. It is very scary and whoever you’ll complain, all will blame you. If you are running PHP7 Nginx on Ubuntu 16.04 LTS, there is less to fear. A simple reboot will work fine. Here is Somewhat Fix of PHP7 Nginx Sudden 404 With Log recv() failed 104: Connection reset by peer. 12 Hourly Manually Check Your App on PHP7.
I Need Permanent Fix of PHP7 Nginx Sudden 404 and recv() failed 104: Connection reset
There is no permanent fix. Many users of PHP7 Nginx on Ubuntu 16.04 searched for solution on various question and answer forums. Reboot fix this error, you may try
service php7.0-fpm restart before it. Restarting PHP7.0-FPM or Rebooting will clear the 404 error clarifying problem with PHP7.0-FPM settings. It can happen out of bug or old code in application. You should log at debug level.
The particular error means that
fastcgi-process is not accessible by
nginx – either for being slow or not corresponding at all.
Intermediate Fix of PHP7 Nginx Sudden 404 and recv() failed 104: Connection reset Error
The general root cause of the problem is related to PHP-FPM. A general guideline should work for almost every one :
- Make sure that you do not use APC or APCu. In other words – disable it regardless of RAM you have. It made our one dedicated server down, it has GB RAM running only WordPress with hardly 5000 page views per day.
- Check Nginx and PHP-FPM settings to exclude any version specific error.
You can set automatic restart via cron, at every 12 hourly interval with 5 minute countdown on SSH (to warn you doing some work on SSH). Run :
sudo crontab -e
Add this line :
55 5,17 * * * /sbin/shutdown -r +5
You will have restart on 6AM and 6PM everyday. The above is a dirty trick to avoid any eventual miss of monitoring or reach to SSH. However, this is not really a complete fix. I personally do not think there will be any long term fix for WordPress because of poor quality coding on third party plugins, themes. Run
last reboot command to check the log of reboot on Ubuntu 16.04.