По какой-то причине мой apache2 перестал работать. Я попытался удалить его, проблема остается той же. Вот некоторые команды и их результаты, которые я попробовал, которые могут вам помочь:
sudo systemctl status apache2
:
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-06-21 13:41:56 IST; 13min ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 19571 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jun 21 13:41:56 kabir systemd[1]: apache2.service: Control process exited, code=exited status=1
Jun 21 13:41:56 kabir systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 21 13:41:56 kabir systemd[1]: Failed to start The Apache HTTP Server.
Jun 21 13:41:56 kabir apachectl[19571]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1
Jun 21 13:41:56 kabir apachectl[19571]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Jun 21 13:41:56 kabir apachectl[19571]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Jun 21 13:41:56 kabir apachectl[19571]: no listening sockets available, shutting down
Jun 21 13:41:56 kabir apachectl[19571]: AH00015: Unable to open logs
Jun 21 13:41:56 kabir apachectl[19571]: Action 'start' failed.
Jun 21 13:41:56 kabir apachectl[19571]: The Apache error log may have more information.
sudo systemctl restart apache2
:
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
netstat -an | grep ": 80"
:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 192.168.43.128:33944 117.18.237.29:80 TIME_WAIT
tcp 0 0 192.168.43.128:33864 117.18.237.29:80 ESTABLISHED
tcp 0 0 192.168.43.128:34524 23.217.53.84:80 ESTABLISHED
tcp 0 0 192.168.43.128:54364 172.217.166.163:80 ESTABLISHED
tcp 0 0 192.168.43.128:54206 172.217.166.163:80 TIME_WAIT
tcp 0 0 192.168.43.128:33946 117.18.237.29:80 ESTABLISHED
tcp 0 0 192.168.43.128:34522 23.217.53.84:80 ESTABLISHED
tcp6 0 0 :::80 :::* LISTEN
sudo apachectl start
:
Invoking 'systemctl start apache2'.
Use 'systemctl status apache2' for more info.
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
Action 'start' failed.
The Apache error log may have more information.
sudo netstat -lnap
:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
-
tcp6 0 0 :::80 :::* LISTEN 1276/nginx: master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1276/nginx: master
You cannot have two HTTP servers listening on the same port in the same machine(The exception is when you put them on different interfaces or when you use Bridge Network Connections) .Looks the nginx server is running in your system , so if you want to use Apache2 instead , you can stop the nginx service :
sudo service nginx stop
and if you want to prevent nginx to start automatically at boot time (which might prevent apache2 to start or even vice versa) you can disable its service via systemctl :
sudo systemctl disable nginx