- You are missing TLS certificates so even if you configure the redirect the browser will only respond with certificate error.
You must configure the
ssl_certificate
and ssl_certificate_key
directives
And you must specify ssl and http2 on the listening directive for HTTP/2
For HTTP/3 http3 implies mandatory ssl, so no ssl directive should be specified in that case.
Your configuration has an infinite redirection loop which makes the server unusable.
Especially you are infinitely redirecting to HTTPS.
Your server is lacking IPv6 support.
You should do something like this:
server {
listen 0.0.0.0:80 default_server;
listen [::]:80 default_server;
location / {
return 308 https://$host$request_uri/something;
}
}
server {
listen 0.0.0.0:443 http3 reuseport;
listen 0.0.0.0:443 http2 ssl;
listen [::]:443 http3 reuseport;
listen [::]:443 http2 ssl;
server_name $YOURDOMAIN;
ssl_certificate $CERT_PATH;
ssl_certificate_key $CERT_KEY;
[...]
}
See also the Mozilla TLS configuration tool to help you:
https://ssl-config.mozilla.org/
And adjust it to your needs.
Note: The above config lines regarding to http3 only is useful if you compile NGINX with HTTP/3 support, which is only available on nginx-quic branch.