This morning I had a call that on one of the servers the web server is not working. Restarting the apache2 process fixed the problem, but I can't understand the reason for the crash.I've checked all logs, and the only relevant information about the accident is in the error.log:[Tue Feb 07 06:25:39.804775 2017] [mpm_prefork:notice] [pid 16376] AH00171: Graceful restart requested, doing restartAH00557: apache2: apr_sockaddr_info_get() failed for ourdomain.comAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message[Tue Feb 07 06:25:59.749847 2017] [unique_id:alert] [pid 16376] (EAI 2)Name or service not known: AH01564: unable to find IPv4 address of ourdomain.com[Tue Feb 07 06:26:09.760784 2017] [:emerg] [pid 16376] AH00020: Configuration Failed, exiting[Tue Feb 07 11:44:50.000663 2017] [:notice] [pid 4841] ModSecurity for Apache/2.8.0 (http://www.modsecurity.org/) configured.[Tue Feb 07 11:44:50.001311 2017] [:notice] [pid 4841] ModSecurity: APR compiled version=1.5.1; loaded version=1.5.1[Tue Feb 07 11:44:50.001317 2017] [:notice] [pid 4841] ModSecurity: PCRE compiled version=8.35 ; loaded version=8.39 2016-06-14[Tue Feb 07 11:44:50.001324 2017] [:warn] [pid 4841] ModSecurity: Loaded PCRE do not match with compiled![Tue Feb 07 11:44:50.001326 2017] [:notice] [pid 4841] ModSecurity: LUA compiled version=Lua 5.1[Tue Feb 07 11:44:50.001328 2017] [:notice] [pid 4841] ModSecurity: LIBXML compiled version=2.9.1[Tue Feb 07 11:44:50.001330 2017] [:notice] [pid 4841] Original server signature: Apache/2.4.10 (Debian) OpenSSL/1.0.1t[Tue Feb 07 11:44:50.001364 2017] [:notice] [pid 4841] ModSecurity: StatusEngine call: 2.8.0,StanSoftWeb 6.22,1.5.1/1.5.1,8.35/8.39 2016-06-14,Lua 5.1,2.9.1,82[Tue Feb 07 11:44:51.420554 2017] [:notice] [pid 4841] ModSecurity: StatusEngine call successfully sent. For more information visit: http://status.modsecurity.org/[Tue Feb 07 11:44:52.000688 2017] [core:warn] [pid 4848] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run?We didn't intentionally requested a greceful restart for sure. The server is AWS EC2 instance if that matters. I'm seeing this graceful restart in the logs every few hours, but without issues - the web server was operating good for months, no configuration changes in the meantime.AH00020: Configuration Failed, exiting is the line I can't explain to myself.I'm out of ideas, can anyone suggest what's the reason for the crash?
Apache2 stopped without any obvious reason
apache httpd;dns;amazon ec2;crash
The first few lines in your log show that your DNS wasn't available, which Apache needs to be available so it can look up your site's FQDN given the IP address(es) you've told it to bind to. (And it needs that in order to handle the HTTP/1.1 Host header, among other things.)That gives you several possible solutions:Use the ServerName directive to give Apache the FQDN explicitly, as the log entry suggests. Then you don't need DNS.Make sure your DNS stays up. Standard practice is to use at least two DNS servers, ideally geographically-separated, so that if one server or route to that server goes down, the other is still available.DNS slows down badly when this happens as systems time out waiting for their first DNS packets to time out before trying the second, but at least things eventually do proceed. DNS caching helps here.There are many companies that do nothing but supply secondary DNS for you, so you don't have to set up a whole other data center, or rent a whole EC2 instance or VPS just to stand up a secondary DNS server. Many other companies provide secondary DNS as one of their general suite of Internet hosting services.Use your OS's /etc/hosts file to map IPs to domain names, and tell your OS's name resolver to use that information preferentially to DNS. This is not only faster than DNS, its lifetime is inherently tied to that of your Apache host machine. About the only way for it to go down is for someone to fat-finger an edit to /etc/hosts.If you choose this option, consider doing the above options as well. You want secondary DNS anyway, and there's no particular reason to force Apache to do reverse lookups on IPs to figure out host names in the first place, since it's not information that's likely to change.