我刚刚安装了 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.
这里可能是什么问题?
首先,Ubuntu 上的 apache 进程命名
apache2
与httpd
CentOS 不同。因此,您需要验证它是否已停止使用:此外,您需要使用以下命令确认没有进程正在侦听端口 80:
另一件要确认的事情,查看 apache2 访问日志以确认您正在访问这台机器而不是其他任何机器
/var/log/apache2/access.log