Publication date: 2023-04-15
When using nginx for serving web pages via https (tcp/443), it makes sense to forward any request to http (tcp/80). This worked fine. However, "certbot" failed due to inaccessible data in the folder ".well-known".
Looking for a suitable configuration in the web, a merged multiple configuration snippets into the following. One requirement was to have an IPv6-compatible configuration.
server {
listen [::]:80 ipv6only=off;
server_name _;
root /var/www/webroot;
location /.well-known {
try_files $uri $uri/ =404;
}
location / {
return 301 https://$host$request_uri;
}
}
This works for me.
Search engine results and some already present configuration were merged.