Skip to content

Instantly share code, notes, and snippets.

@tmulzer
Last active March 13, 2022 22:59
Show Gist options
  • Save tmulzer/e8c407f88bd8a31ed5be653cd4313893 to your computer and use it in GitHub Desktop.
Save tmulzer/e8c407f88bd8a31ed5be653cd4313893 to your computer and use it in GitHub Desktop.
nginx-config für reverse-proxy mit http innen, https außen.
#!/bin/bash
ufw disable
certbot --expand -n --nginx --domains <dns_a_name>,<dns_cname_1>,<dns_cname_2>,[...]
ufw enable
[...]
server{
listen 80;
# listen [::]:80; // if IPv6 enabled.
server_name <external_dns_cname>;
return 301 https://$host$request_uri;
}
// [...]
server {
listen 443 ssl;
# listen [::]:443 ssl; // if IPv6 enabled.
server_name <external_dns_cname>;
location / {
proxy_pass http://<internal_ip_[:<port>]>/;
}
ssl_certificate /etc/letsencrypt/live/<dns_name_of_hostsystem_with_certbot>/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/<dns_name_of_hostsystem_with_certbot>/privkey.pem; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment