我剛剛安裝了 ubuntu 16.04 和 apache2。即使我停止 apache2,也會顯示預設設定頁面。這絕對是奇怪的,因為沒有 httpd 進程。伺服器繼續提供預設檔案並更改文件顯示更改。
這是控制台上的輸出:
user@rex:~$ sudo /etc/init.d/apache2 stop
[ ok ] Stopping apache2 (via systemctl): apache2.service.
user@rex:~$ ps -ef | grep httpd
user 1855 1642 0 16:03 pts/0 00:00:00 grep --color=auto httpd
user@rex:~$ sudo /etc/init.d/apache2 status
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead) since Thu 2017-01-19 16:03:20 CET; 44s ago
Docs: man:systemd-sysv-generator(8)
Process: 1785 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 1768 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Jan 19 16:03:20 rex apache2[1768]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Jan 19 16:03:20 rex apache2[1768]: no listening sockets available, shutting down
Jan 19 16:03:20 rex apache2[1768]: AH00015: Unable to open logs
Jan 19 16:03:20 rex apache2[1768]: Action 'start' failed.
Jan 19 16:03:20 rex apache2[1768]: The Apache error log may have more information.
Jan 19 16:03:20 rex apache2[1768]: *
Jan 19 16:03:20 rex apache2[1785]: * Stopping Apache httpd web server apache2
Jan 19 16:03:20 rex apache2[1785]: *
Jan 19 16:03:20 rex systemd[1]: Started LSB: Apache2 web server.
Jan 19 16:03:46 rex systemd[1]: Stopped LSB: Apache2 web server.
這裡可能有什麼問題?
答案1
首先,Ubuntu上的apache進程的命名與CentOS中的不同apache2
。httpd
因此,您需要使用以下方法驗證它是否已停止:
$ ps -ef | grep apache
另外,您需要使用以下命令確認沒有進程正在偵聽連接埠 80:
$ sudo netstat -lntp | grep 80
另一件需要確認的事情是,請查看 apache2 存取日誌以驗證您正在存取這台機器而不是任何其他機器/var/log/apache2/access.log