Wednesday, March 16, 2016

apache 2.2 - bind apache2 to localhost only Ubuntu 12.04.3 LTS



Trying to bind apache2 to localhost only, running Ubuntu 12.04.3 LTS on OpenVZ VPS. It fails on me (see /var/log/apache2/error.log). Default configuration is:



# 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.

::1 localhost ip6-localhost ip6-loopback
# netstat -lntup
tcp6 0 0 :::80 :::* LISTEN 623/apache2



I change Listen 80 to Listen 172.0.0.1:80 in /etc/apache2/ports.conf.



Apache2 errors out. There is no other service listening on port 80, also there is no other (conflicting) Listen declaration, just the default ports.conf apache2 ships with + the single change described.



# cat /var/log/apache2/error.log
apache2: Could not reliably determine the server's fully qualified domain name, using 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


Answer



localhost address is 127.0.0.1 not 172.0.0.1


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...