Nginx + Lets Encrypt + Https redirect
Solution 1:
I made this to work with the following vhost configuration:
server {
listen 80;
server_name example.com;
location /.well-known/ {
root /whatever/i/specified/in/certbot/-d/argument;
}
location / {
return 301 https://$host$request_uri;
}
}
(the SSL vhost configuration is not important here)
What is different from yours is that I have root
inside location
. This setup works very well on multitude of reverse proxy and origin servers.