Binding Apache to Specific IP Address

apache-2.2bindipport

I have three IPs. I am trying to bind Apache to two of my IP addresses to leave the third free for other uses(Node.js). At present, Apache is listening on all IP addresses. httpd.conf:

Listen 80

I only want Apache to bind to two of my addresses. I have tried following this doc and replaced the above Listen 80 with the following:

Listen XX.XX.XX.XX:80
Listen XX.XX.XX.XX:80

However, when I try to restart Apache, I get the following error:

Stopping httpd:        [FAILED]
(99)Cannot assign requested address: make_sock: could not bind to address XX.XX.XX.XX:80
no listening sockets available, shutting down

I don't understand how port 80 is free to be used for all IP addresses, but when I specify individual IPs, it errors. Does anyone have any ideas?

Thank you.

Best Answer

You only need to bind 1 IP address to apache.

Listen [myIP1]:80

Thats all you need.