small_server_thingies/nginx/ssl_setup.md
2022-11-24 22:48:51 +01:00

847 B

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.