Vps – Apache server hangs after a few hours, needs restart

apache-2.4slow-connectionvpsWordpress

I have a VPS, with 2 GBytes of RAM on an Ubuntu 14 machine. After a while I decided to upgrade my packages in the machine, including installing the latest version of apache2 (2.4.7).

However, after a few days, problems have began to appear regarding my wordpress (v 4.0) installation. When I restart the apache server, it does fine, serving pages. Then, after a few hours, any request to the server takes 1-2 minutes to get a response. I don't have much traffic to the web server, to justify this delay. Not by a long shot. This also happens regarding HTML pages, not just PHP.

When I restart the apache server, everything is OK, until problems start again, after a few hours, when the server becomes unresponsive.

Here is my /etc/apache2/mods-enabled/mpm_prefork.conf file:

<IfModule mpm_prefork_module>
    StartServers            10
    MinSpareServers         10
    MaxSpareServers         30
    MaxRequestWorkers       100
    MaxConnectionsPerChild  2000
</IfModule>

I have also tried to increase those numbers (up to the point where the apache processes would consume as high as 1,6GB) to no avail.

I don't know many things about apache configurations, can anyone point me in the right direction to find the error?

Best Answer

Turns out that I was the victim of xmlrpc attacks on wordpress.

I checked the logs and saw hundreds of requests on my xmlrtc.php wordpress file, by a single entity. I changed my .htaccess file to contain one additional rewrite rule:

RewriteRule ^xmlrpc.php$ "http://0.0.0.0/" [R=301,L]

And so far I have not experienced any problems.

Related Topic