报错:
[root@web01 ~]# systemctl restart httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
[root@web01 ~]# journalctl -xe
-- 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.
Oct 21 00:12:48 web01 httpd[8872]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name,
Oct 21 00:12:48 web01 httpd[8872]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Oct 21 00:12:48 web01 httpd[8872]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 21 00:12:48 web01 httpd[8872]: no listening sockets available, shutting down
Oct 21 00:12:48 web01 httpd[8872]: AH00015: Unable to open logs
Oct 21 00:12:48 web01 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 21 00:12:48 web01 kill[8873]: kill: cannot find process ""
Oct 21 00:12:48 web01 systemd[1]: httpd.service: control process exited, code=exited status=1
Oct 21 00:12:48 web01 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.
Oct 21 00:12:48 web01 systemd[1]: Unit httpd.service entered failed state.
Oct 21 00:12:48 web01 systemd[1]: httpd.service failed.
Oct 21 00:12:48 web01 polkitd[6063]: Unregistered Authentication Agent for unix-process:8866:779613 (system bus name :1.1
解决方案:
查看80端口是否被占用
[root@web01 ~]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 6751 root 6u IPv4 35889 0t0 TCP *:http (LISTEN)
nginx 6752 www 6u IPv4 35889 0t0 TCP *:http (LISTEN)
可见被nginx占用,打开httpd配置文件修改端口
[root@web01 ~]# vim /etc/httpd/conf/httpd.conf
搜索Listen 改为8080
[root@web01 ~]# systemctl restart httpd
[root@web01 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-10-21 00:14:38 CST; 6s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 8873 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Main PID: 8953 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─8953 /usr/sbin/httpd -DFOREGROUND
├─8954 /usr/sbin/httpd -DFOREGROUND
├─8955 /usr/sbin/httpd -DFOREGROUND
├─8956 /usr/sbin/httpd -DFOREGROUND
├─8957 /usr/sbin/httpd -DFOREGROUND
└─8958 /usr/sbin/httpd -DFOREGROUND
Oct 21 00:14:07 web01 systemd[1]: Starting The Apache HTTP Server...
Oct 21 00:14:17 web01 httpd[8953]: AH00558: httpd: Could not reliably determine the server's fully qualified dom...essage
Oct 21 00:14:38 web01 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
搞定!!!
注意:
再次访问一定要吧端口加进去,比如访问10.0.0.5:8080 中间的冒号一定是英文格式,不然访问不出