我已经使用 yum 更新sudo yum update
并安装了sudo yum install httpd
我编辑了 httpd.conf,因此 ServerName 是我远程访问的 Web 服务器的 IP 地址。
当我尝试重新启动 httpd 时using sudo service httpd restart
收到以下错误消息:
httpd.service 的作业失败,因为控制进程以错误代码退出。有关详细信息,请参阅“systemctl status httpd.service”和“journalctl -xe”。
systemctl -l status httpd.service 返回以下内容:
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-07-11 14:20:39 EDT; 1min 22s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 3275 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 3273 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS)
Main PID: 3273 (code=exited, status=0/SUCCESS)
Jul 11 14:20:39 blondie systemd[1]: Starting The Apache HTTP Server...
Jul 11 14:20:39 blondie httpd[3273]: httpd (pid 2260) already running
Jul 11 14:20:39 blondie kill[3275]: kill: cannot find process ""
Jul 11 14:20:39 blondie systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 11 14:20:39 blondie systemd[1]: Failed to start The Apache HTTP Server.
Jul 11 14:20:39 blondie systemd[1]: Unit httpd.service entered failed state.
Jul 11 14:20:39 blondie systemd[1]: httpd.service failed.
运行 journalctl -xe 返回:
Unit user-0.slice has begun starting up.
Jul 11 14:10:01 blondie systemd[1]: Started Session 7 of user root.
-- Subject: Unit session-7.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-7.scope has finished starting up.
--
-- The start-up result is done.
Jul 11 14:10:01 blondie systemd[1]: Starting Session 7 of user root.
-- Subject: Unit session-7.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-7.scope has begun starting up.
Jul 11 14:10:01 blondie CROND[3154]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 11 14:10:01 blondie systemd[1]: Removed slice user-0.slice.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished shutting down.
Jul 11 14:10:01 blondie systemd[1]: Stopping user-0.slice.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has begun shutting down.
Jul 11 14:10:40 blondie sudo[3162]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/bin/systemctl status
Jul 11 14:13:09 blondie sudo[3164]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/sbin/service httpd -
Jul 11 14:16:19 blondie sudo[3195]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/bin/nano /etc/httpd/
Jul 11 14:16:40 blondie sudo[3212]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/bin/nano /etc/httpd/
Jul 11 14:18:19 blondie sudo[3215]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/sbin/apachectl confi
Jul 11 14:19:14 blondie sudo[3221]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/bin/nano /etc/httpd/
Jul 11 14:20:01 blondie systemd[1]: Created slice user-0.slice.
-- Subject: Unit user-0.slice has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished starting up.
--
-- The start-up result is done.
Jul 11 14:20:01 blondie systemd[1]: Starting user-0.slice.
-- Subject: Unit user-0.slice has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has begun starting up.
Jul 11 14:20:01 blondie systemd[1]: Started Session 8 of user root.
-- Subject: Unit session-8.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-8.scope has finished starting up.
--
-- The start-up result is done.
Jul 11 14:20:01 blondie systemd[1]: Starting Session 8 of user root.
-- Subject: Unit session-8.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-8.scope has begun starting up.
Jul 11 14:20:01 blondie CROND[3225]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 11 14:20:01 blondie systemd[1]: Removed slice user-0.slice.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished shutting down.
Jul 11 14:20:01 blondie systemd[1]: Stopping user-0.slice.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has begun shutting down.
Jul 11 14:20:14 blondie sudo[3251]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/bin/nano /etc/httpd/
Jul 11 14:20:39 blondie sudo[3255]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/sbin/service httpd r
Jul 11 14:20:39 blondie polkitd[637]: Registered Authentication Agent for unix-process:3256:362038 (system bus name :1.63 [/usr
Jul 11 14:20:39 blondie systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Jul 11 14:20:39 blondie httpd[3273]: httpd (pid 2260) already running
Jul 11 14:20:39 blondie kill[3275]: kill: cannot find process ""
Jul 11 14:20:39 blondie systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 11 14:20:39 blondie 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.
Jul 11 14:20:39 blondie systemd[1]: Unit httpd.service entered failed state.
Jul 11 14:20:39 blondie systemd[1]: httpd.service failed.
Jul 11 14:20:39 blondie polkitd[637]: Unregistered Authentication Agent for unix-process:3256:362038 (system bus name :1.63, ob
Jul 11 14:22:01 blondie sudo[3280]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/bin/systemctl -l sta
Jul 11 14:23:13 blondie sudo[3283]: admin1 : TTY=pts/0 ; PWD=/home/admin1 ; USER=root ; COMMAND=/bin/journalctl -xe
我尝试删除 httpd 并重新安装,但无法让 httpd 重新启动
答案1
看起来你可能有一个孤立的 PID 文件。有一个 httpd 的 PID,但是 kill 没有看到它的进程。
检查top
是否有任何僵尸进程。也ps aux | grep httpd
可以查看正在运行的进程。
如果是这种情况,您必须终止父进程以清理它(ps -Hfwe
或pstree -paul
找到它),或者重新启动。
希望您可以执行 systemctl start。