Skip to content

Instantly share code, notes, and snippets.

@brandondees
Last active December 16, 2021 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandondees/ddd2ac2110daa96ef7b846bc3c1e572d to your computer and use it in GitHub Desktop.
Save brandondees/ddd2ac2110daa96ef7b846bc3c1e572d to your computer and use it in GitHub Desktop.
How To Configure NGINX for switching TLS certs by domain name for HNS + ICANN dual name support.
server {
server_name starservice *.starservice;
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /root/ssl/starservice/cert.crt;
ssl_certificate_key /root/ssl/starservice/cert.key;
root /root/www/starservice;
index index.html;
try_files $uri $uri/ $uri.html =404;
}
server {
server_name starservice.space *.starservice.space;
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/starservice.space/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/starservice.space/privkey.pem;
root /root/www/starservice;
index index.html;
try_files $uri $uri/ $uri.html =404;
}
@brandondees
Copy link
Author

Credit to @pinheadmz for this content, he asked me to gist and link to it so that he doesn't have to do it himself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment