Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 0.0.0.0, responding to requests on all inbound traffic. How could this scenario be implemented?

share|improve this question
add comment

2 Answers

up vote 10 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
add comment

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
add comment

Your Answer

 
discard

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.