Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can a pair of http servers be configured to both listen on port 80, but on different interfaces on the same server?

Specifically, I would like to run nginx and apache on one machine (CentOS 6) for different applications on different IPs.

I believe that by default Apache binds to, responding to requests on all inbound traffic. How could this scenario be implemented?

share|improve this question
up vote 12 down vote accepted

In Apache, change a Listen 80 to Listen X.X.X.X:80.

In nginx, change a listen 80; to listen Y.Y.Y.Y:80;.

share|improve this answer
well, shoot - that was substantially simpler than I had yet seen in the documentation :) .. thanks! – warren Jan 20 '12 at 22:01

Once a service bound to a specific port, no other services will be permitted to bind to that port. You may have to use different port.

What kind of a scenario you are trying to implement? Is that Nginx load balancing?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.