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.

Can a single server run both haproxy and nginx at the same time?

I guess I would have to run nginx on a different port, and then route specific traffic to nginx?

Say I have 2 domains, 1 requires nginx and the other requires another service.

Can haproxy send requests for domain#1 to nginx? and domain#2 to another server?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Yes you can, in fact this was what stackoverflow was doing for a while. Basically you pick one to be in front of the other. The one in front would be on port 80 and the one behind it will be on some random port of your choosing. You would just treat the second load balancer as if it was a web server behind the load balancer. Just keep in mind you will probably want to enable the X-Forwarded-For feature so you actually see the client IPs.

If you want them both to be on port 80 and not be in front of each other than you can bind them each to a specific IP address.

See this post for a similar situation: Nginx (for static files) and Apache (for dynamic content)?

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.