Linux – Running two http servers, but binding to different interfaces

apache-2.2linuxnginx

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?

Best Answer

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;.

Related Topic