CentOS上启动Apache报错

系统版本为 CentOS 7,启动Apache报错
图片描述

[root@localhost wiki]# service httpd start
Redirecting to /bin/systemctl start  httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
[root@localhost wiki]# 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 五 2018-10-26 11:32:58 CST; 11s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 43586 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 43584 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 43584 (code=exited, status=1/FAILURE)

10月 26 11:32:58 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
10月 26 11:32:58 localhost.localdomain httpd[43584]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443
10月 26 11:32:58 localhost.localdomain httpd[43584]: no listening sockets available, shutting down
10月 26 11:32:58 localhost.localdomain httpd[43584]: AH00015: Unable to open logs
10月 26 11:32:58 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
10月 26 11:32:58 localhost.localdomain kill[43586]: kill: cannot find process ""
10月 26 11:32:58 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
10月 26 11:32:58 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
10月 26 11:32:58 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
10月 26 11:32:58 localhost.localdomain systemd[1]: httpd.service failed.

从网上查到的说法是端口被占用,解决办法是找到被占用的这个端口然后kill掉对应的进程,然后再重启httpd。但这个方法对我没有用,因为该服务器上之前就部署过禅道和SVN,而我查了该端口对应的应用程序就是Nginx,我没法kill它对应的进程,那在这个情况下,该怎么做呢?

阅读 5.1k
1 个回答
  1. 首先,我认为有必要评估下,是否有足够的理由同时部署Nginx和Apache。换句话说,Apache上有什么需求是Nginx不能顺带做了的?
  2. 如果一定有理由的话,由于Nginx是主配,那么就需要改一下Apache的设置,比如原来监听的是80接口,那么现在就可以改到8080或者任意一个未被占用的接口上去,这样才能保证二者不会冲突。
  3. 由于Nginx是在前级接收请求的,那么需要把原本需要给Apache的请求单独挑出来,反代到Apache监听的接口上去。网上Nginx反代的配置太多了,不再赘述。
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题