Several times a day hang out all the sites on the server. Helps only init 6. What could be the problem?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Good afternoon. For a few days on the server appears a strange problem crash all the sites completely and saves only init 6. in htop the CPU usage drops to almost 0. iotop also shows almost zero. iftop is similar.

in the Apache logs, nothing. in the logs of nginx:
In 229892 nginx upstream timed out (110: Connection timed out) while connecting to upstream, client

Everything works in conjunction with apache + nginx.

Restart Apache and nginx does not help. after restart only 1-2 seconds to open a page, but then again, everything hangs.

System - Ubuntu 16.04 .
Apache/2.4.18 (Ubuntu)
nginx version: nginx/1.12.2

A couple of days ago was got some kind of virus miner, Minero. was launched from the /tmp directory and loaded percents on 100%. don't know this is related to this or not, but the virus I had only seen twice. as sites fall off every 5 hours.

where the virus is started - is not found.
by | 28 views

3 Answers

0 like 0 dislike
reinstall the server from scratch
if you don't know how and where was the virus, it makes sense to look for a malfunction Apache no, your system is already fully compromised
0 like 0 dislike
You have completely kompromentirovat server, to demolish and to put from zero
0 like 0 dislike
Look at outgoing connections, maybe they score a connection to Apache(netstat-anp|grep tcp|grep apache2)
The fact that the /tmp directory that the service runs, does not mean that the server was hacked(could be cracked separate CMS or script), it makes sense to move the server there.
It is better to consult cherudim people(especially at the time of the problem), such errors quickly fixate with sufficient experience.
110,608 questions
257,187 answers
40,796 users