I've got a server with a bunch of IP addresses, and I only want Apache listening on one of them. It doesn't sound like a hard thing to do, and I've done it once before a while ago, but I'm having some trouble this time around. First off, here's where I'm at now, to my understanding:
Every place Apache is listening to port 80, it's listening only on the correct IP.
/etc/apache2$ grep -R ":80" .
./sites-available/default:<VirtualHost 192.168.0.82:80>
./httpd.conf:<VirtualHost 192.168.0.82:80>
./ports.conf:NameVirtualHost 192.168.0.82:80
./sites-enabled/000-default:<VirtualHost 192.168.0.82:80>
There's no mention of listening on 0.0.0.0.
/etc/apache2$ grep -R "0\.0\.0\.0" .
And yet... Apache refuses to start.
/etc/apache2$ sudo /etc/init.d/apache2 start
* Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
[fail]
In case someone asks, I'm not bound to that address:
/etc/apache2$ sudo netstat -nap | grep :80
tcp 0 0 192.168.0.83:80 0.0.0.0:* LISTEN 2822/node
The error log at /var/log/apache2/error.log
just says:
[Wed Aug 08 03:30:18 2012] [notice] caught SIGTERM, shutting down
Have I missed a spot in Apache's config? Is there something I'm not remembering to look for? Why is this not as simple as I remembered it being?
Listen 192.168.0.82:80
line, which is what I needed. I selected cjc's answer because it went into a bit more depth as to why that line was needed. I thought mentioning the comments used in the version of Apache that comes packaged with CentOS was a nice addition. But since everyone seems to be in general agreement that the answer should go to pauska, I've gone ahead and given it to him. After all, I notice by looking at the revisions that pauska's comment significantly influenced cjc's answer in its current form.