欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

thinkphp Apache配置重启Apache1 restart 出错解决办法

程序员文章站 2024-03-07 12:51:57
概要:   thinkphp 在apache上配置启用伪静态,重启apache1 restart 竟然失败了,报错     job for httpd.service...

概要:

  thinkphp 在apache上配置启用伪静态,重启apache1 restart 竟然失败了,报错

    job for httpd.service failed because the control process exited with error code. see "systemctl status httpd.service" and "journalctl -xe" for details

  嗯,看状态

  执行命令 systemctl status httpd.service

[root@cloud1 bin]# systemctl 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 五 2016-08-26 11:13:09 cst; 6min ago
   docs: man:httpd(8)
      man:apachectl(8)
 process: 9915 execstop=/bin/kill -winch ${mainpid} (code=exited, status=1/failure)
 process: 9913 execstart=/usr/sbin/httpd $options -dforeground (code=exited, status=1/failure)
 main pid: 9913 (code=exited, status=1/failure)
 
8月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)address already in use: ah00072: make_sock: could not bind to address [::]:80
8月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)address already in use: ah00072: make_sock: could not bind to address 0.0.0.0:80
8月 26 11:13:09 cloud1.localdomain httpd[9913]: no listening sockets available, shutting down
8月 26 11:13:09 cloud1.localdomain httpd[9913]: ah00015: unable to open logs
8月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/failure
8月 26 11:13:09 cloud1.localdomain kill[9915]: kill: cannot find process ""
8月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
8月 26 11:13:09 cloud1.localdomain systemd[1]: failed to start the apache http server.
8月 26 11:13:09 cloud1.localdomain systemd[1]: unit httpd.service entered failed state.
8月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service failed.

从上可以看到,80端口被占用了

 执行journalctl -xe

[root@cloud1 bin]# journalctl -xe
--
-- unit session-9830.scope has finished starting up.
--
-- the start-up result is done.
8月 26 11:01:01 cloud1.localdomain systemd[1]: starting session 9830 of user root.
-- subject: unit session-9830.scope has begun start-up
-- defined-by: systemd
-- support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- unit session-9830.scope has begun starting up.
8月 26 11:01:01 cloud1.localdomain crond[9744]: (root) cmd (run-parts /etc/cron.hourly)
8月 26 11:01:01 cloud1.localdomain run-parts(/etc/cron.hourly)[9747]: starting 0anacron
8月 26 11:01:01 cloud1.localdomain run-parts(/etc/cron.hourly)[9753]: finished 0anacron
8月 26 11:01:01 cloud1.localdomain run-parts(/etc/cron.hourly)[9755]: starting 0yum-hourly.cron
8月 26 11:01:01 cloud1.localdomain run-parts(/etc/cron.hourly)[9759]: finished 0yum-hourly.cron
8月 26 11:10:01 cloud1.localdomain systemd[1]: started session 9831 of user root.
-- subject: unit session-9831.scope has finished start-up
-- defined-by: systemd
-- support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- unit session-9831.scope has finished starting up.
--
-- the start-up result is done.
8月 26 11:10:01 cloud1.localdomain systemd[1]: starting session 9831 of user root.
-- subject: unit session-9831.scope has begun start-up
-- defined-by: systemd
-- support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- unit session-9831.scope has begun starting up.
8月 26 11:10:01 cloud1.localdomain crond[9870]: (root) cmd (/usr/lib64/sa/sa1 1 1)
8月 26 11:13:09 cloud1.localdomain polkitd[1171]: registered authentication agent for unix-process:9908:450142261 (system bus name :1.19686 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object p
8月 26 11:13:09 cloud1.localdomain 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.
8月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)address already in use: ah00072: make_sock: could not bind to address [::]:80
8月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)address already in use: ah00072: make_sock: could not bind to address 0.0.0.0:80
8月 26 11:13:09 cloud1.localdomain httpd[9913]: no listening sockets available, shutting down
8月 26 11:13:09 cloud1.localdomain httpd[9913]: ah00015: unable to open logs
8月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/failure
8月 26 11:13:09 cloud1.localdomain kill[9915]: kill: cannot find process ""
8月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
8月 26 11:13:09 cloud1.localdomain 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.
8月 26 11:13:09 cloud1.localdomain systemd[1]: unit httpd.service entered failed state.
8月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service failed.
8月 26 11:13:09 cloud1.localdomain polkitd[1171]: unregistered authentication agent for unix-process:9908:450142261 (system bus name :1.19686, object path /org/freedesktop/policykit1/authenticatio
 

上面这是查看日志

 查看apache中的 httpd-vhosts.conf 文件,发现listen 80 两次,httpd-vhosts.conf一次,httpd.conf一次

虚拟机里的加个#listen 80  ok解决了

备注:apache\apache\conf下,extraoriginal文件夹的含义

    extra的意思是额外扩展

    original的意思是源目录文件

    original文件夹是配置文件的源文件备份,而真正要配置的是conf目录下的httpd.conf文件以及extra目录的额外扩展配置。

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!