From b752ea4cd41dda60d5fa5a86d81693923b7d61f9 Mon Sep 17 00:00:00 2001 From: pablo Date: Thu, 24 Nov 2022 22:48:51 +0100 Subject: [PATCH] How to set up HTTPS. --- nginx/ssl_setup.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 nginx/ssl_setup.md diff --git a/nginx/ssl_setup.md b/nginx/ssl_setup.md new file mode 100644 index 0000000..4f32877 --- /dev/null +++ b/nginx/ssl_setup.md @@ -0,0 +1,34 @@ +# SSL or HTTPS + +The other day I successfully set up SSL for the LNBits reverse proxy. Here is +what I did: + +- Downloaded the keys for my domain certificates from porkbun. +- Made the certs available inside the nginx container. +- Added the following stuff in the config file for nginx. + +``` +server { + listen 80; + server_name lnbits.contrapeso.xyz; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + server_name lnbits.contrapeso.xyz; + ssl_certificate /certs/domain.cert.pem; + ssl_certificate_key /certs/private.key.pem; + ssl_trusted_certificate /certs/intermediate.cert.pem; + + location / { + proxy_pass http://100.93.54.53:3007; + proxy_set_header Host $host; + proxy_redirect off; + } +} +``` + +- Profit! http gets forbidden with the first block, and https works with the + second bit. +