Since a while I’m experiencing 501 timeouts on my DO hosted WP website.
I checked /var/log/nginx/error.log
and I’ve gotten about two errors per minute (they stopped all of the sudden and my website is online again since).
The logs contain a bunch of lines which boil down to these two:
connect() to unix:/var/run/php/php7.2-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: [REDACTED], server: [REDACTED].com, request: "POST /xmlrpc.php HTTP/1.0", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "[REDACTED]"
upstream timed out (110: Connection timed out) while reading response header from upstream, client: [REDACTED], server: [REDACTED].com, request: "POST /wp-cron.php?doing_wp_cron=1585826903.9321999549865722656250 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock", host: "[REDACTED].com", referrer: "https://[REDACTED].com/wp-cron.php?doing_wp_cron=1585826903.9321999549865722656250"
Any suggestions on how track down what is going on?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Hi there @angieCoral,
It looks like that your PHP FPM service is crashing, this is why you are seeing these errors in your Nginx error log.
I could suggest checking your PHP FPM error log for more information on why the service is crashing. The log is usually stored at
/var/log/fpm-php.www.log
though the location might be different depending on your configuration.A possible issue here could be that PHP is using too much RAM and the PHP FPM process gets killed. If this is the case I would recommend the following:
Make sure that there is enough RAM on the server, to check that you could use the
top
,htop
orfree -m
commandsMake sure that the PHP memory limit is not too high compared to the actual available memory on the Droplet. For example if you have 1GB of RAM available your PHP memory limit should not be more than 64MB otherwise only a few processes could consume all of your memory
Optimize your website by installing a good caching plugin, that way you would reduce the overall resource usage on the server
Delete any plugins that are not being used. Generally speaking, it is always recommended to try and keep the number of your plugins as low as possible
Consider using a CDN like Cloudflare, that way it would offload some of the heavy liftings from your Droplet
As the specific error that you’ve shared is referring to
wp-cron.php
, another thing that you might want to consider is checking your cron jobs and making sure that there are not running too often or the processes are not too resource consuming. If this is the case, try to reduce the frequency or run the cron jobs during the night when the overall load on the server is low.And here is also a quick video demo on how to troubleshoot such issues as well:
Hope that this helps! Regards, Bobby