Apache不会从Centos 7开始

我已经安装http24u到一个Centos 7虚拟机和httpd服务不会正常启动,它会启动大约30秒左右,然后崩溃与下面的消息,这对我来说没有任何意义,任何人都可以摆脱任何光对此有什么build议吗?

journalctl

-- Unit httpd.service has begun starting up. Jun 29 11:02:38 api01 systemd[1]: httpd.service start operation timed out. Terminating. Jun 29 11:02:39 api01 systemd[1]: Failed to start The Apache HTTP Server. -- Subject: Unit httpd.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit httpd.service has failed. -- -- The result is failed. Jun 29 11:02:39 api01 systemd[1]: Unit httpd.service entered failed state. Jun 29 11:02:39 api01 systemd[1]: httpd.service failed. Jun 29 11:02:39 api01 polkitd[811]: Unregistered Authentication Agent for unix-process:31718:120305844 (system bus name :1.1444, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_IE.UT lines 3675-3731/3731 (END) 

Apache日志

 [Wed Jun 29 11:36:18.095653 2016] [:notice] [pid 31869:tid 139893291845824] ModSecurity for Apache/2.7.3 (http://www.modsecurity.org/) configured. [Wed Jun 29 11:36:18.095789 2016] [:notice] [pid 31869:tid 139893291845824] ModSecurity: APR compiled version="1.4.8"; loaded version="1.5.2" [Wed Jun 29 11:36:18.095797 2016] [:warn] [pid 31869:tid 139893291845824] ModSecurity: Loaded APR do not match with compiled! [Wed Jun 29 11:36:18.095803 2016] [:notice] [pid 31869:tid 139893291845824] ModSecurity: PCRE compiled version="8.32 "; loaded version="8.32 2012-11-30" [Wed Jun 29 11:36:18.095807 2016] [:notice] [pid 31869:tid 139893291845824] ModSecurity: LUA compiled version="Lua 5.1" [Wed Jun 29 11:36:18.095816 2016] [:notice] [pid 31869:tid 139893291845824] ModSecurity: LIBXML compiled version="2.9.1" [Wed Jun 29 11:36:18.095820 2016] [:notice] [pid 31869:tid 139893291845824] Original server signature: Apache [Wed Jun 29 11:36:18.181331 2016] [mpm_event:notice] [pid 31869:tid 139893291845824] AH00489: Apache/2.4.20 (CentOS) OpenSSL/1.0.1e-fips Skynet configured -- resuming normal operations [Wed Jun 29 11:36:18.181422 2016] [core:notice] [pid 31869:tid 139893291845824] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Wed Jun 29 11:37:48.132327 2016] [mpm_event:notice] [pid 31869:tid 139893291845824] AH00492: caught SIGWINCH, shutting down gracefully 

systemctl启动httpd

这就是我在系统崩溃之前在systemctl status httpd上看到的内容。

 ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: activating (start) since Wed 2016-06-29 14:42:03 IST; 25s ago Main PID: 32435 (httpd) CGroup: /system.slice/httpd.service ├─32435 /usr/sbin/httpd -DFOREGROUND ├─32439 /usr/sbin/rotatelogs /var/log/httpd/error_log.%Y-%m-%d 86400 ├─32440 /usr/sbin/rotatelogs /var/log/httpd/access_log.%Y-%m-%d 86400 ├─32441 /usr/sbin/rotatelogs /var/log/httpd/access_log.%Y-%m-%d 86400 ├─32442 /usr/sbin/httpd -DFOREGROUND ├─32443 /usr/sbin/httpd -DFOREGROUND └─32444 /usr/sbin/httpd -DFOREGROUND Jun 29 14:42:03 api01 systemd[1]: Starting The Apache HTTP Server... 

之后崩溃:

 ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: failed (Result: timeout) since Wed 2016-06-29 14:43:34 IST; 38s ago Process: 32435 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS) Main PID: 32435 (code=exited, status=0/SUCCESS) Jun 29 14:42:03 api01 systemd[1]: Starting The Apache HTTP Server... Jun 29 14:43:33 api01 systemd[1]: httpd.service start operation timed out. Terminating. Jun 29 14:43:34 api01 systemd[1]: Failed to start The Apache HTTP Server. Jun 29 14:43:34 api01 systemd[1]: Unit httpd.service entered failed state. Jun 29 14:43:34 api01 systemd[1]: httpd.service failed. 

我昨天在Centos7上有这个问题,日志里没有提示问题是什么。

我可以运行apache,但不能从systemctl运行 – 在决定启动失败之后,可以运行约90秒,然后终止服务。

我的情况竟然是DNS在我不知道的新防火墙上被阻止; 解除DNS解决了我的问题。

服务器上的硬件规格是什么? 你可以尝试运行systemctl status httpd -l并向我们​​显示输出吗?

启动后,您可以运行top并按shift + m键,确保它不会占用您所有的机器内存。

这是由于系统崩溃后,httpd pid文件仍然存在。 Systemd仍然看到服务已经开始…

在我身边,我有一个像这样的ExecPreStart选项:

 ExecPreStart=[[ -f /var/run/httpd/httpd.pid ]] && /bin/rm -f /var/run/httpd/httpd.pid 

也许有一个更优雅的解决scheme…