I’ve been a DigitalOcean user for a few years now, so when I decided to start this WordPress blog I chose the DigitalOcean WordPress One-Click Install. Unfortunately, the WordPress One-Click Install wasn’t very stable out-of-the-box.
Not long after creating my new WordPress droplet (a basic blog with very low expected traffic), I noticed my site was offline. This sort of thing can happen, so I just restarted the server, and didn’t give it another thought.
Some time after, maybe a few weeks or a month later, the site went down again. I restarted again. It was at this point that the issue got worse. It became a weekly occurrence, and eventually the site wouldn’t stay up for more than a few hours at a time.
Sometimes the page would just time out and other times I’d get the error “Error establishing a database connection”.
(SOME of) the Solutions
Once it became clear that the problem wasn’t going away, I start looking for answers. I found a few tutorials that proved helpful.
I followed much of the advice from the above articles. I’d implement a change, restart my droplet and wait for the next crash. The results were from a few hours of uptime to a full day. None of the above changes fixed the problem, so continued searching the web for solutions to MySql and Apache running out of memory.
Tips I found on these two pages finally did the trick:
- Apache Performance Tuning: KeepAlive to remove latency
- Configuring Apache/PHP/MySQL for Low Memory (RAM) VPS
My site has been stable for a few months now, so it appears that something I did fixed it. Unfortunately, as these things often go, I can’t say for sure what combination of the above fixes actually did the trick.