试图将apache2绑定到本地主机上,在OpenVZ VPS上运行Ubuntu 12.04.3 LTS。 它失败了(见/var/log/apache2/error.log)。 默认configuration是:
# cat /etc/hosts fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.0.1 localhost.localdomain localhost # Auto-generated hostname. Please do not remove this comment. <some-ext-ipv6-address> <some-hostname> ::1 localhost ip6-localhost ip6-loopback # netstat -lntup tcp6 0 0 :::80 :::* LISTEN 623/apache2
在/etc/apache2/ports.conf中将Listen 80更改为Listen 172.0.0.1:80。
Apache2出错了。 在端口80上没有其他服务监听,也没有其他(冲突)的监听声明,只是默认的ports.conf apache2附带了+所描述的单个变更。
# cat /var/log/apache2/error.log apache2: Could not reliably determine the server's fully qualified domain name, using <some-ext-ipv6-address> for ServerName (99)Cannot assign requested address: make_sock: could not bind to address 172.0.0.1:80 no listening sockets available, shutting down Unable to open logs
本地主机地址是127.0.0.1而不是172.0.0.1