After successfully converting my home-based server from HTTP to HTTPS using Let's Encrypt, I'd like to add support for IPv6.
Did I make a mistake reconfiguring nginx for that purpose?
#OK
curl -4 https://www.acme.com
#OK
curl -6 https://www.acme.com
#OK
Chrome http://[2a01:blah:7ac6]/
#NOK
Chrome https://[2a01:blah:7ac6]/
"Your connection to this site is not secure"
Thank you.
~# cat /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
server {
root /usr/share/nginx/acme;
index index.html index.htm;
server_name www.acme.com acme.com;
error_page 404 /404.html;
#Add to allow IPv6
listen [::]:443 ssl;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.acme.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.acme.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.acme.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name www.acme.com acme.com;
listen 80;
#Add to allow IPv6
listen [::]:80;
return 404; # managed by Certbot
}
You cannot use the IP address in the HTTPS URL unless the IP address itself is also in the certificate. Chrome matches the URL hostname to the identifiers in the cert.
Let's Encrypt recently added support for IP addresses in the cert. However, this requires use of the shortlived profile and an ACME client that supports profiles, IP addresses, and is very reliable since shortlived certs expire in less than 7 days. For routine web servers a domain name is probably much better suited which allows longer lived certs. See: Profiles - Let's Encrypt
Someone owns and operates that domain. But it isn't you. Please don't use other people's domains in examples. Use something like example.com which is an industry acceptable name for such purposes.