

Varnish is an excellent caching solution for wordpress. In fact we have tested varnish with more than 3000 online visitors and website and server was working perfect!
Plesk with the new docker thing has given us the ability to add varnish to specific websites. What we found is that all the informations regarding Varnish installation with plesk did not mention or solve the SSL issue. Varnish needs some tricks to make it work with SSL.
Plesk is giving this tutorial but if you read in comment most of them are about SSL not working . So we also tried and also found that SSL is not working
https://www.plesk.com/blog/product-technology/varnish-wordpress-docker-container/
usually you see in your browser ” too many redirects” error
So , we found the solution….!!!
You need to add to nginx some more lines…
1. go to nginx.conf file
/var/www/vhosts/system//conf/
edit nginx.conf and add this line
proxy_set_header X-Forwarded-Proto: https;
for example
location / {
proxy_pass https://x.x.x.x:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto: https;
}
2. then open .htaccess file in wordpress directory and and this
SetEnvIf X-Forwarded-Proto https HTTPS=on
for example
# Let apache know we’re behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto “https“ HTTPS=on
that’s it!
If someone found a way to add this to additional directives so you don’t edit the conf files please send me an email so i can correct this!