Today I wanted to run a website with HTTPS and Varnish. Varnish itself does
not support SSL, and for good reasons. So the setup we need is HTTPS termination => Varnish => Webserver. So we need a software that can handle HTTPS and forward requests over HTTP to Varnish. A couple of options for HTTPS termination are HAProxy, Nginx, Squid or Apache. I went with Apache, as it was already installed on the server in question, thus reducing the complexity of the setup.
On Apache, you need to enable mod_proxy. The Apache SSL configuration looks like this:
#/etc/apache2/sites-available/example.com-ssl
<VirtualHost *:443>
ServerName www.example.com
ProxyPreserveHost On
Read more