Apache를 사용하는데 문제가 있습니다. 방금 Centos를 설치했고 나만의 웹 서버를 만들고 싶습니다. 팔로우 중이에요"Centos 7.2를 위한 완벽한 서버"그리고 내 컴퓨터에서 이 오류가 발생했습니다.
[root@server01 /]# sudo systemctl start 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@server01 /]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2016-11-02 14:04:03 PDT; 14s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 30113 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 30065 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 30065 (code=exited, status=1/FAILURE)
Nov 02 14:04:01 server01.tcforwarding.com systemd[1]: Starting The Apache HTTP Server...
Nov 02 14:04:02 server01.tcforwarding.com httpd[30065]: [Wed Nov 02 14:04:02.346089 2016] [alias:warn] [pid 30065] AH00671: The Scri...Alias.
Nov 02 14:04:02 server01.tcforwarding.com httpd[30065]: AH00548: NameVirtualHost has no effect and will be removed in the next relea...nf:356
Nov 02 14:04:02 server01.tcforwarding.com httpd: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Nov 02 14:04:02 server01.tcforwarding.com systemd: httpd.service: main process exited, code=exited, status=1/FAILURE
Nov 02 14:04:02 server01.tcforwarding.com kill: kill: cannot find process ""
Nov 02 14:04:03 server01.tcforwarding.com systemd httpd.service: control process exited, code=exited status=1
Nov 02 14:04:03 server01.tcforwarding.com systemd: Failed to start The Apache HTTP Server.
Nov 02 14:04:03 server01.tcforwarding.com systemd: Unit httpd.service entered failed state.
Nov 02 14:04:03 server01.tcforwarding.com systemd: httpd.service failed.
누구든지 이 문제를 해결하도록 도와줄 수 있나요?
런닝 sudo netstat -nap | grep :80
리턴
[root@server01 /]# sudo netstat -nap | grep :80
tcp 0 0 192.168.0.22:56616 104.16.13.8:80 TIME_WAIT -
tcp 0 0 192.168.0.22:43882 151.101.193.69:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:37556 151.101.129.69:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:37722 151.101.65.69:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:47506 151.101.1.69:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:55722 54.225.161.140:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:40710 107.14.33.34:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:43884 151.101.193.69:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:39374 50.16.185.14:80 ESTABLISHED 6833/firefox
tcp 0 0 192.168.0.22:57408 104.16.12.8:80 ESTABLISHED 6833/firefox
tcp6 0 0 2605:e000:9290:cf:57260 2607:f8b0:4007:80c::443 ESTABLISHED 6833/firefox
tcp6 0 0 2605:e000:9290:cf:42280 2607:f8b0:4007:801:::80 ESTABLISHED 6833/firefox
tcp6 0 0 2605:e000:9290:cf:35994 2607:f8b0:4007:80c::443 ESTABLISHED 6833/firefox
tcp6 0 0 2605:e000:9290:cf:42210 2607:f8b0:4007:80b:::80 ESTABLISHED 6833/firefox
이제 Firefox를 닫은 후 동일한 명령을 실행하십시오.
[root@server01 /]# sudo netstat -nap | grep :80
tcp 0 0 192.168.0.22:39514 151.101.129.69:80 TIME_WAIT -
tcp 0 0 192.168.0.22:39516 151.101.129.69:80 TIME_WAIT -
tcp 0 0 192.168.0.22:57042 54.243.224.230:80 TIME_WAIT -
tcp 0 0 192.168.0.22:59396 104.16.12.8:80 TIME_WAIT -
tcp 0 0 192.168.0.22:39734 151.101.65.69:80 TIME_WAIT -
tcp 0 0 192.168.0.22:58596 104.16.13.8:80 TIME_WAIT -
tcp 0 0 192.168.0.22:39510 151.101.129.69:80 TIME_WAIT -
tcp 0 0 192.168.0.22:37124 96.6.122.178:80 TIME_WAIT -
tcp 0 0 192.168.0.22:39696 151.101.65.69:80 TIME_WAIT -
tcp 0 0 192.168.0.22:57710 54.225.161.140:80 TIME_WAIT -
tcp 0 0 192.168.0.22:47790 64.95.32.61:80 TIME_WAIT -
tcp6 0 0 2605:e000:9290:cf:33722 2607:f8b0:4007:80b::443 TIME_WAIT -
tcp6 0 0 2605:e000:9290:cf:53536 2607:f8b0:4007:801::443 TIME_WAIT -
tcp6 0 0 2605:e000:9290:cf:58196 2607:f8b0:4007:806:::80 TIME_WAIT -
tcp6 0 0 2605:e000:9290:cf:51876 2607:f8b0:4007:800::443 TIME_WAIT -
이제 이 명령을 다시 실행해도 systemctl status httpd.service
여전히 같은 오류가 발생합니다.
[root@server01 /]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2016-11-02 20:34:28 PDT; 9s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 17357 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 17343 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 17343 (code=exited, status=1/FAILURE)
Nov 02 20:34:27 server01.tcforwarding.com systemd[1]: Starting The Apache HTTP Server...
Nov 02 20:34:28 server01.tcforwarding.com httpd[17343]: [Wed Nov 02 20:34:28.202720 2016] [alias:warn] [pid 17343] AH00671: The Scr...Alias.
Nov 02 20:34:28 server01.tcforwarding.com httpd[17343]: AH00548: NameVirtualHost has no effect and will be removed in the next rele...nf:356
Nov 02 20:34:28 server01.tcforwarding.com httpd[17343]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Nov 02 20:34:28 server01.tcforwarding.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Nov 02 20:34:28 server01.tcforwarding.com kill[17357]: kill: cannot find process ""
Nov 02 20:34:28 server01.tcforwarding.com systemd[1]: httpd.service: control process exited, code=exited status=1
Nov 02 20:34:28 server01.tcforwarding.com systemd[1]: Failed to start The Apache HTTP Server.
Nov 02 20:34:28 server01.tcforwarding.com systemd[1]: Unit httpd.service entered failed state.
Nov 02 20:34:28 server01.tcforwarding.com systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
문제로 인해 여전히 실행이 되지 않습니다.
명령을 실행하면 nmap 192.168.0.1
반환됩니다.
Starting Nmap 6.40 ( http://nmap.org ) at 2016-11-06 15:52 PST
Nmap scan report for server01.tcforwarding.com (192.168.0.1)
Host is up (0.000016s latency).
Not shown: 992 closed ports
PORT STATE SERVICE
21/tcp open ftp
25/tcp open smtp
53/tcp open domain
110/tcp open pop3
143/tcp open imap
993/tcp open imaps
995/tcp open pop3s
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.15 seconds
포트 80이나 포트 443이 전혀 표시되지 않는 이유는 무엇입니까?
답변1
이미 포트 80에서 무언가를 실행하고 있습니다. 이 명령은 당신을 위해 그것을 식별합니다
sudo netstat -nap | grep ':80 .*LISTEN'
답변2
어떤 서비스가 어떤 포트에서 실행되고 있는지 확인하려면 nmap을 사용한다고 말하고 싶습니다. nmap 결과는 다음과 같습니다.
$ nmap 192.168.50.25
...
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http <~ make sure service is http
443/tcp open https
http 이외의 다른 항목이 포트 80을 사용하는 경우 Apache 구성을 변경하여 다른 포트를 가리키거나 포트 80을 사용하는 서비스를 다른 포트로 변경할 수 있습니다.nmap 설치 가이드는 다음과 같습니다.
답변3
먼저 다음 명령을 사용해야 합니다.
netstat -natup |grep 80
어떤 서비스가 실행 중인지 알려야 하며 다른 서비스에서 포트 80을 사용하는 경우 해당 서비스를 종료해야 합니다.
그래도 문제가 해결되지 않으면 httpd.conf의 권한을 확인하고 다음 명령이 있는지 확인할 수 있습니다.
listen [::]:80
귀하의 시스템 로그에서 오류를 알 수 있기 때문입니다.
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
때때로 이 문제는 ipv6으로 인해 발생하므로 conf에 해당 명령을 추가해야 합니다.
listen [::]:80 ipv6only=off default_server;
그런 다음 httpd 서비스를 다시 시작하십시오.