How do I stop a small WordPress website crashing so regularly on Digital Ocean account?

Sorry, not sure how or where to ask this, but this seems a better place than SO.

I have a small WP website hosted on a Digital Ocean droplet and it keeps falling over with an “Error establishing a database connection” error. Restarting the server resolves it. This is a bog standard, (very) low traffic WordPress site.

I’ve hosted similar, small WP sites for many years on standard shared hosting but for some reason, now I’ve moved this site to DO, it falls over on an absurdly regular basis. I’ve checked the plugins, security and such and can’t see anything that would cause this. I’ve upgraded the account three times but I was under the impression a small site like this could be hosted for a couple dollars, not the $25 or such I’m paying now.

Again, this is a very low-traffic, bog standard WP website and I can’t see anything out of the ordinary considering I’ve had experience with WP sites for over 10 years and I didn’t have any issues before moving the site. Other than a one page portfolio, this is the only site on my account,

I feel like I’m missing something obvious, and as someone who’s not very good with DevOps, I realise I’ve made a mistake choosing DO, but I’m hosting this site for my sister and I’m hoping there’s some sort of obvious thing I’m missing before I move it again.

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi, did you ever figure it out? The same thing was/is happening to me. Then randomly my site is back up, and all of the content/media is gone. Thank you, Jordan.

Hi @philhancox,

It seems to me something is causing load on your Droplet and the Droplet is forced to kill some services so that it doesn’t crash. In most cases that’s the Database service thus you getting the Error establishing database connection.

My first suggestion would be to add SWAP to your Droplet if you don’t already have one. You can follow this tutorial if unsure how:

Next, I would recommend optimizing your website and Droplet.

On the Droplet side, I’ll recommend using Opcache + php_fpm. These two will tremendously help you with how your Server is handling your Website.

Regarding your Website, I think you should install a Caching plugin, a plugin to optimize your images and similar stuff.

If you are still experiencing issues, I’ll recommend checking out top while inside your Droplet to see where exactly the high load comes from.