How to use nginx as reverse proxy send all requests to varnish

Solution 1:

I can come up with 3 possible solutions:

  1. Don't worry about plain HTTP on port 80 and just let Varnish handle it
  2. Create a vhost for plain HTTP
    • Configure Varnish to listen on port 6081
    • Copy the server block from your Nginx configuration
    • Adjust the block to make sure it listens on port 80
    • Remove the SSL bits from the duplicated server block
    • Make sure your proxy all requests to port 6081
  3. Create a redirection vhost for plain HTTP
    • Configure Varnish to listen on port 6081
    • Create a server block that redirects all HTTP requests to the HTTPS equivalent