Hi,
For testing purposes on Ubuntu Server 16 I installed
apache which hosts a normal website with
varnish as web app cache and
nginx as reverse proxy for ssl. I'm using nginx, because varnish doesn't support https. Apache resides on one server, varnish and nginx on another (on the same lan, of course). The reason why I also installed nginx was that I wanted https.
The problem that I have now is that I don't know how to redirect the traffic from port 80 to port 443. I made varnish listen to localhost:80, so that it can be reached only through nginx.
What I tried in nginx conf file was the following:
Code:
server {
listen 172.31.108.183:80 default_server;
return 301 https://$host$request_uri;
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/nginx_ssl.cert;
ssl_certificate_key /etc/nginx/ssl/nginx_ssl.key;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name my_server_name;
location / {
proxy_pass http://127.0.0.1:80;
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;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Host $host;
}
}
But when I try to connect, I get this: ERR_TOO_MANY_REDIRECTS
What am I doing wrong?