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. +