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

My idea is put NGINX as proxy to redirect to Varnish (cache static content) and then proxy to apache with a lot of VirtualHost in different IPs. My problems is that I would know how can configure Varnish to send access to correct IP, I am going explain:

  • NGINX:

    • Listen in:, and on ports: 80 and 443
    • Proxy redirect to Varnish, and
  • Varnish:

    • Port: 8080 - THIS IS THE PROBLEM
    • Proxy content not static to Apache on port 8000 - THIS IS THE OTHER PROBLEM
  • Apache2:

    • Listen in:, and
    • Response correct VirtualHost

This is the idea. When I try with one IP only, all work correctly, because Varnish is only listen in one IP and port and send to backend in one IP and port too.

Could you help me to configure Varnish or there is a best way to configure similar scenario please?

share|improve this question
up vote 2 down vote accepted

You shouldn't need to differentiate based on IP addresses once you have the decoded packet (i.e if you're doing SSL offloading with Nginx).

Once you've got the decoded packet, Varnish can pass the content directly onto Apache, and Apache can work out what site it needs to go to based on the Host header inside the HTTP request - you shouldn't need to have the IPs separate all the way down.

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.