1

I have set up a digital ocean server to host a wordpress website. I set it up as the basic $10 server as I don't expect much traffic.

After setting it up I followed the Digital Ocean security tips and added a user for myself and set myself as a sudo-er. I also disabled SSH access as root.

I had what seems to be a very common issue with wordpress on digital ocean, MySQL was giving an out of memory exception. I therefore created a 4GB Swap file as this seems to be the remedy, and I've not seen that error since.

A couple of days ago I did some work on the site and got it ready to release. I wrote 30 small blog posts and added a plugin called Yoast for SEO. I left the site overnight and came to it the next day on my lunch break, only to find the site was down.

After I reboot the server the site last for 10 minutes or so and then crashes again. MySQL seems to be hogging a lot of RAM, but I'm not getting the database error I saw last time.

I have even upped the Server to the $20 version with double the RAM, but it makes no difference.

I have also noticed a ridiculous spike in CPU usage the night after I finished installing Yoast and writing my blogs: the site has been unstable ever since.

CPU Spike

Whilst the website is inaccessible I can still access the server via the webconsole on the Digital Ocean site.

The website's not even up long enough to get a backup of the content I've setup on wordpress. Any ideas how I can sort this out?

1 Answer 1

1

You didn't post any error logs or other precise information about the downtime so I can only be general for now...

The moment you launch any server, right away it will be under attack. It's the sad fact of online life. You have no real traffic yet, but already see spikes. Typical sign of attack probes. Ward off these attempts with for example Fail2Ban. Block their SSH login attempt, block their Wordpress login attempts and ban their IPs for a few days.

Next, if your Wordpress site is quite static (no login required for end users) then you should look at caching. For static pages it shouldn't be necessary to hit MySQL. I prefer Wordfence's Falcon cache with Nginx, but it also works on Apache.

Also, make your server more self-healing with the help of for example Monit. It's easy to check RAM usage, and restart RAM hoggers like MySQL or the webserver preventatively. Or to auto-restart MySQL when it is down.

But really, you should activate and investigate some logging, expand your post with more details about your webstack setup (MySQL version, engine, PHP version, webserver etc.) and try and find out what is really happening.

1
  • Caching at the web server layer is much much faster for semi-static sites, logged in users can bypass the cache. CloudFlare also provides a useful amount of protection for free. photographerstechsupport.com/tutorials/…
    – Tim
    May 26, 2016 at 22:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .