Apache SSL Termination (HTTPS Varnish cache)

General approach

Varnish configuration

...
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}
...

Apache configuration


  ServerName localhost.com
  DocumentRoot /var/www/magento/pub

    RequestHeader set X-Forwarded-Proto "https"
    ServerName localhost.com

    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/cert.crt
    SSLCertificateKeyFile /etc/apache2/ssl/cert.key

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:80/
    ProxyPassReverse / http://127.0.0.1:80/

Apache modules

sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod proxy
sudo a2enmod proxy_balancer
sudo a2enmod proxy_http
sudo service apache2 restart

 

Free Web Hosting