Binding Apache to a Specific Or Secondary IP Address

Apache, by default, will attempt to bind to and listen on these interfaces:


1. “” means ALL IPv4 addresses that the system has (including

2. “::” means ALL IPv6 addresses that the system has (including ::1).

When started, Apache will try to take all the IP addresses of the system, and if you are already running another web-server (such as IIS, Tomcat, Nginx, Jetty, Domino, etc) on that same system, Apache will not be able to bind to “” and “::”, and will fail to start. Or, if started first, after binding to all the available IP addresses, it will prevent the other web-server form starting.

To bind Apache to a specific or secondary IP address:

Edit file –

Find and replace these two lines (one is at the beginning, the other at the end) –

Listen 80
Listen 443

With –


You can specify multiple IP addresses with multiple lines.

If this is a public server, make sure that the IP addresses you are using, are either the resolvable IP addresses of your Apache hosted domain names (e.g., the Public IP address), or the LAN IP addresses that the Router is port-forwarding outside port 80 and 443 traffic to.

If this is a intranet server, you can just bind Apache to the LAN IP.

If this is a localhost server, you can just bind Apache to

Also make sure that your other web-server is binding only to a specific IP address, and not to “”.

After making changes, if Apache won’t start, check the configuration by running (from the command line):

httpd -t -n "Apache2"
httpd -k start -n "Apache2"

One thought on “Binding Apache to a Specific Or Secondary IP Address”

  1. For WampDeveloper Pro, if you change it from the default of or “”, to a specific IP, you will also need to bind it to IP address:

    As the configuration, Local DNS, and phpmyadmin, all use

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>