在CentOS 7上,重新启动HTTPD

分享于 

3分钟阅读

互联网

  繁體

问题:

我有一个运行CentOS 7.的实例,在重启httpd时遇到了困难。


systemctl list-unit-files | grep nginx




nginx-debug.service disabled


nginx.service enabled



当我尝试sudo systemctl status httpd


● httpd.service - The Apache HTTP Server


 Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)


 Drop-In: /etc/systemd/system/httpd.service.d


 └─limits.conf


 Active: failed (Result: exit-code) since Wed 2020-11-18 12:45:19 UTC; 4min 58s ago


 Main PID: 14586 (code=exited, status=1/FAILURE)



Nov 18 12:45:19 server.dogbia.tk systemd[1]: Starting The Apache HTTP Server...


Nov 18 12:45:19 server.dogbia.tk httpd[14586]: [Wed Nov 18 12:45:19.489844 2020] [so:warn] [pi...ing


Nov 18 12:45:19 server.dogbia.tk httpd[14586]: AH00558: httpd: Could not reliably determine th...age


Nov 18 12:45:19 server.dogbia.tk httpd[14586]: (98)Address already in use: AH00072: make_sock:...080


Nov 18 12:45:19 server.dogbia.tk httpd[14586]: no listening sockets available, shutting down


Nov 18 12:45:19 server.dogbia.tk httpd[14586]: AH00015: Unable to open logs


Nov 18 12:45:19 server.dogbia.tk systemd[1]: httpd.service: main process exited, code=exited, ...URE


Nov 18 12:45:19 server.dogbia.tk systemd[1]: Failed to start The Apache HTTP Server.


Nov 18 12:45:19 server.dogbia.tk systemd[1]: Unit httpd.service entered failed state.


Nov 18 12:45:19 server.dogbia.tk systemd[1]: httpd.service failed.


Hint: Some lines were ellipsized, use -l to show in full.




答案1:

运行命令sudo ss -lptn 'sport = :80' 查看使用端口80的内容。

在启动httpd之前,你需要停止使用端口80的服务,不能同时在同一个端口上运行两个webservers。

然后停止它,如果它是Nginx,运行:


sudo systemctl stop nginx





HTTP  REST  Centos  httpd