无法在centos服务器上启动apache,未给出错误,只是超时

时间:2019-01-16 15:40:02

标签: apache server centos

一般来说,我对apache和ssh都是陌生的,因此,即使这是我所缺少的愚蠢事物,我也将不胜感激。

我正在将网站迁移到新服务器,并正在设置httpd。我不得不将旧的httpd.conf更新为现在的2.4标准,但是现在当我运行systemctl start httpd时,它挂了3分钟以上,然后返回:

Job for httpd.service failed because a fatal signal was delivered to the control process. See "systemctl status httpd.service" and "journalctl -xe" for details.

status httpd.service返回

httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: signal) since Wed 2019-01-16 14:58:37 GMT; 35s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 30118 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=killed, signal=KILL)
 Main PID: 30118 (code=killed, signal=KILL)
   CGroup: /system.slice/httpd.service

Jan 16 14:55:37 server.miniserver.com systemd[1]: Starting The Apache HTTP Server...
Jan 16 14:57:07 server.miniserver.com systemd[1]: httpd.service start operation timed out. Terminating.
Jan 16 14:58:37 server.miniserver.com systemd[1]: httpd.service stop-final-sigterm timed out. Killing.
Jan 16 14:58:37 server.miniserver.com systemd[1]: httpd.service: main process exited, code=killed, status=9/KILL
Jan 16 14:58:37 server.miniserver.com systemd[1]: Failed to start The Apache HTTP Server.
Jan 16 14:58:37 server.miniserver.com systemd[1]: Unit httpd.service entered failed state.
Jan 16 14:58:37 server.miniserver.com systemd[1]: httpd.service failed.

journalctl -xe返回

Jan 16 15:13:34 server.miniserver.com systemd[1]: Cannot add dependency job for unit rpcbind.socket, ignoring: Unit not found.
Jan 16 15:13:34 server.miniserver.com systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
--
-- Unit httpd.service has begun starting up.
Jan 16 15:15:04 server.miniserver.com systemd[1]: httpd.service start operation timed out. Terminating.
Jan 16 15:16:35 server.miniserver.com systemd[1]: httpd.service stop-final-sigterm timed out. Killing.
Jan 16 15:16:35 server.miniserver.com systemd[1]: httpd.service: main process exited, code=killed, status=9/KILL
Jan 16 15:16:35 server.miniserver.com systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed

httpd \ error_log:

[Wed Jan 16 15:13:34.752306 2019] [auth_digest:notice] [pid 30342:tid 140325595289728] AH01757: generating secret for digest authentication ...
[Wed Jan 16 15:13:34.753268 2019] [core:warn] [pid 30342:tid 140325595289728] AH00098: pid file /etc/httpd/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Jan 16 15:13:34.754601 2019] [mpm_event:notice] [pid 30342:tid 140325595289728] AH00489: Apache/2.4.6 (CentOS) configured -- resuming normal operations
[Wed Jan 16 15:13:34.754626 2019] [core:notice] [pid 30342:tid 140325595289728] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

我不一定知道如何解析所有内容,也不知道有什么特别突出的地方。我还能做什么进一步调试?

2 个答案:

答案 0 :(得分:0)

我在Apache第三方模块上遇到了这个问题,这是很常见的,因为它们的配置不正确并导致服务失败。 我会为您的模块创建一个备份,并单独测试每个模块的服务。

答案 1 :(得分:0)

我在ProxMox 5.4上安装的Centos 7 VM上遇到了相同的问题,其中基础服务器断电了。相同的症状,没有明显的错误,只是非描述性超时。在停电之前,它工作正常。

我结束了对#LoadModule systemd_module modules/mod_systemd.so的注释,并启动了httpd。不知道为什么它起作用,但是它到底是什么。

这是现在的conf文件,以及有关谁的其他信息:

[root@zabbix httpd]# cat /etc/httpd/conf.modules.d/00-systemd.conf
# This file configures systemd module:
LoadModule systemd_module modules/mod_systemd.so
[root@zabbix httpd]# uname -a
Linux zabbix 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@zabbix httpd]# httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built:   Jul 29 2019 17:18:49
Server's Module Magic Number: 20120211:24
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"