I want to install and configure varnish with Magento 2 on my server running apache as incredibly impressed with the performance gains. Just wanted to know a bit about configuring SSL with this as have not done this in my dev environment.
I have also however been told by my hosting provider that to have varnish work on my site i can only have one site on my server. Is this correct? My testing shows multiple sites seemingly working fine so wondering what this could be about?
Best Answer
Varnish in the open source version does not support SSL termination. Therefore you have to set up a reverse proxy like a nginx or similar. The nginx is responsible to terminate the SSL and forward the request to varnish.
Magento 2 works well with varnish, even in a multi-site environment.
As you use Apache, you need to enable mod_proxy. In addition to that add a virtual host that listens to port 443 like so:
The ProxyPass should point to your varnish instance.