在我的设置中,我使用NGINX作为代理来处理http和https请求,然后使用Varnish作为后端,以便NGINX处理所有SSL证书。
下面是我的NGINX ssl模板的示例:
server {
listen server-ip:443 ssl;
server_name example.com www.example.com;
ssl_certificate /home/user/conf/web/ssl.example.com.pem;
ssl_certificate_key /home/user/conf/web/ssl.example.com.key;
location / {
proxy_pass http://varnish-ip:6081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Nginx on;
proxy_redirect off;
}
location @fallback {
proxy_pass http://varnish-ip:6081;
}
}