I have installed varnish and nginx and secured my website with lets encrypt SSL. I tested varnish against nginx cgi cache and i have found out that varnish is a bit faster in my use case (wordpress). So i need some help on how to use nginx for SSL termination with varnish and how to forward http to https as my website is https only. I am running ubuntu 18.04
Please help me someone!!
EDIT: I followed this guide: https://www.linode.com/docs/websites/varnish/use-varnish-and-nginx-to-serve-wordpress-over-ssl-and-http-on-debian-8/
It gives my error in nginx (port 80 already in use)
Please help me!
Best Answer
Assumptions
As you can see, my setup differs a little from the one in https://www.linode.com/docs/websites/varnish/use-varnish-and-nginx-to-serve-wordpress-over-ssl-and-http-on-debian-8/. That's because I already tackle HTTP to HTTPS redirection using a separate Nginx vhost.
In this case, Varnish is not listening on port 80, but on 6081.
HTTPS vhost
Here's an example of an Nginx vhost that processes the HTTPS connections:
HTTP to HTTPS redirection vhost
Here's a snippet that redirects HTTP to HTTPS:
Redacted content
The vhosts have been redacted and contain example values. Please replace the hostnames accordingly in the
server_name
expressions.Please also make sure
ssl_certificate
andssl_certificate_key
statements point to files that actually exist.