# Certbot http challenge # and http to https redirection # For http certificate verification upstream certbot { server 127.0.0.1:8001; } server { listen [::]:80; listen 80; server_name _; location /.well-known/acme-challenge { proxy_pass http://certbot; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } location / { return 301 https://$host$request_uri; } }