Two apache servers using same port?

JJ Edgar VI asked:

so I have two apache servers on the same system.

Basically what I’m trying to figure out is if since I have 2 different IPs running on my system is it possible to have two different apache servers running on different IPs but using the default port(80) so the user doesn’t have to specify the port in the address bar?

What I am trying to do is make it so that if the users visits:

example.com —-> Apache Server 1 running on 1.1.1.1:80

mail.example.com —-> Apache Server 2 running on 2.2.2.2:80

This would make it so that each domain would point to different apache servers but on the same system.

Thank you, JJ Edgar

My answer:


You can control which IP address Apache listens on using the Listen directive.

Just make sure that each server’s configuration specifies only the IP addresses you want to use for that particular server.

For instance:

Server 1:

Listen 203.0.113.5:80

Server 2:

Listen 203.0.113.6:80

Any <VirtualHost> directives you use must also specify their IP addresses, rather than using the wildcard *.

See the Apache documentation for further details.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.