将 apache2 绑定到本地主机 Ubuntu 12.04.3 LTS

将 apache2 绑定到本地主机 Ubuntu 12.04.3 LTS

尝试将 apache2 仅绑定到本地主机,在 OpenVZ VPS 上运行 Ubuntu 12.04.3 LTS。它失败了(请参阅 /var/log/apache2/error.log)。默认配置为:

# 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 上侦听,也没有其他(冲突的)侦听声明,只有 apache2 附带的默认 ports.conf + 所述的单个更改。

# 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

答案1

本地主机地址是 127.0.0.1 而不是 172.0.0.1

相关内容