我使用sudo yum update更新了yum,并安装了sudo yum install httpd
我编辑了httpd.conf,这样ServerName就是我远程login的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重新启动
看起来你可能有一个孤立的PID文件。 有一个PID的httpd,但杀并没有看到它的过程。
检查top ,看看是否有任何僵尸进程。 另外ps aux | grep httpd ps aux | grep httpd只是为了看看正在运行。
如果是这样的话,你将不得不杀死父进程来清理它( ps -Hfwe或者pstree -paul ps -Hfwe来find它),或者重启。
希望你可以做一个systemctl开始。