Hi all
I receive random mails from the Watchdog, that Apache or Nginx have been restarted. That cause an outage of the Websites of 5 Minutes. Any Idea, how to avoid this?
It's the latest Plesk on Ubuntu 18.04, ModSecurity and Fail2ban are set up. I don't even see the reason for the crashes, has no corellation with the strange Memory-Load I
see on Apache.
Thanks a lot!
OLAF
@Olaf Kapinski
I suppose that you have some timeout issues on one or more domains, causing Apache to hang, with the hanging Apache causing Nginx to malfunction.
First of all, try to find the problematic domains (if any) and increase the values for max_execution_time and max_input_time via the Plesk Panel.
Second, verify that the file /etc/nginx/conf.d exists and contains
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
or values higher than that.
Note that it is not recommended to increase the before mentioned values too much, since that could cause undesired results: for instance, Nginx will be waiting for Apache responses, even if Apache is down.
Third, try to run some tests by overloading the server: for example, upload a huge file or do some ab testing.
If the before mentioned tests do not yield alarming results, then the actions in step 1 (see first point) were probably sufficient for now and the near future.
If you still have problems with Apache and Nginx restarting randomly, then you can enter directives for proxy buffering or proxy caching in the Nginx configuration.
Note that it is recommended to start with proxy caching:
not only will you (partially) isolate issues at the Apache level from those on the Nginx level (read: if proxy caching is enabled and the current problem persists, then you are
almost certain that the root cause of the problem is to be found at the Apache level, since Nginx simply would serve put a non-cached response from Apache in the cache and serve from cache otherwise........in short, if Nginx does not serve a page, Apache was not able to pass responses to Nginx),
but also proxy caching can easily be enabled via the Nginx Caching functionality that is present in Plesk version 17.8.11 and higher.
I hope that all of the above helps a bit........or points you in the right direction of the root cause of your problem.
Kind regards..........
PS It can be meaningful to run the procedure outlined in steps 1 to 3 twice, with ModSecurity disabled in the second run. After all, ModSecurity is on the Apache level and, as such, it can be the root cause of the problem.