From 0d8d580fc9487f22ace24e8c202c361339f883fa Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 17 Mar 2023 15:10:15 +0100 Subject: [PATCH 1/2] docs: add nginx ssl proxy info to installation --- docs/guide/installation.md | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 04e77746b..afcf19a66 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -376,6 +376,50 @@ restart apache2 service restart apache2 ``` +## Running behind an nginx reverse proxy over https + +Install nginx: + +```sh +apt-get install nginx certbot +``` + +Create a SSL certificate with LetsEncrypt: + +```sh +certbot certonly --nginx --agree-tos -d lnbits.org +``` + +Create an nginx vhost at `/etc/nginx/sites-enabled/lnbits.org`: + +```sh +cat < /etc/nginx/sites-enabled/lnbits.org +server { + server_name lnbits.org; + + location / { + proxy_pass http://127.0.0.1:5000; + } + + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + + listen [::]:443 ssl; + listen 443 ssl; + ssl_certificate /etc/letsencrypt/live/lnbits.org/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/lnbits.org/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; +} +EOF +``` + +Restart nginx: + +```sh +service restart nginx +``` ## Using https without reverse proxy The most common way of using LNbits via https is to use a reverse proxy such as Caddy, nginx, or ngriok. However, you can also run LNbits via https without additional software. This is useful for development purposes or if you want to use LNbits in your local network. From ec1caa6015c7a95c031c202cd46a5cf269370ede Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 17 Mar 2023 15:13:25 +0100 Subject: [PATCH 2/2] docs: fix readability of HTTPS section in installation --- docs/guide/installation.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/docs/guide/installation.md b/docs/guide/installation.md index afcf19a66..addf70b93 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -298,7 +298,8 @@ Save the file and run the following commands: sudo systemctl enable lnbits.service sudo systemctl start lnbits.service ``` -## Reverse proxy with automatic https using Caddy + +## Reverse proxy with automatic HTTPS using Caddy Use Caddy to make your LNbits install accessible over clearnet with a domain and https cert. @@ -310,11 +311,15 @@ https://caddyserver.com/docs/install#debian-ubuntu-raspbian ``` sudo caddy stop ``` + Create a Caddyfile + ``` sudo nano Caddyfile ``` + Assuming your LNbits is running on port `5000` add: + ``` yourdomain.com { handle /api/v1/payments/sse* { @@ -331,22 +336,30 @@ yourdomain.com { } } ``` + Save and exit `CTRL + x` + ``` sudo caddy start ``` -## Running behind an apache2 reverse proxy over https -Install apache2 and enable apache2 mods +## Running behind an Apache2 reverse proxy over HTTPS + +Install Apache2 and enable Apache2 mods: + ```sh apt-get install apache2 certbot a2enmod headers ssl proxy proxy-http ``` -create a ssl certificate with letsencrypt + +Create a SSL certificate with LetsEncrypt: + ```sh -certbot certonly --webroot --agree-tos --text --non-interactive --webroot-path /var/www/html -d lnbits.org +certbot certonly --webroot --agree-tos --non-interactive --webroot-path /var/www/html -d lnbits.org ``` -create a apache2 vhost at: /etc/apache2/sites-enabled/lnbits.conf + +Create an Apache2 vhost at: `/etc/apache2/sites-enabled/lnbits.conf`: + ```sh cat < /etc/apache2/sites-enabled/lnbits.conf @@ -371,12 +384,14 @@ cat < /etc/apache2/sites-enabled/lnbits.conf EOF ``` -restart apache2 + +Restart Apache2: + ```sh service restart apache2 ``` -## Running behind an nginx reverse proxy over https +## Running behind an Nginx reverse proxy over HTTPS Install nginx: