mirror of
https://github.com/openoms/bitcoin-tutorials.git
synced 2025-12-19 04:54:18 +01:00
nginx config scripts update
This commit is contained in:
@@ -2,13 +2,24 @@
|
|||||||
# To download and run:
|
# To download and run:
|
||||||
# $ wget https://github.com/openoms/bitcoin-tutorials/raw/master/nginx/bonus.SSL_for_RTL.sh && bash bonus.SSL_for_RTL.sh
|
# $ wget https://github.com/openoms/bitcoin-tutorials/raw/master/nginx/bonus.SSL_for_RTL.sh && bash bonus.SSL_for_RTL.sh
|
||||||
|
|
||||||
|
|
||||||
# For the certificate to be obtained successfully a dynamic DNS and port forwarding is needed
|
# For the certificate to be obtained successfully a dynamic DNS and port forwarding is needed
|
||||||
# Need to forward port 80 to the IP of your RaspiBlitz for certbot
|
# Need to forward port 80 to the IP of your RaspiBlitz for certbot
|
||||||
# Forward port 3002 to be able to access RTL from outside of your LAN
|
# Forward port 3002 to be able to access RTL from outside of your LAN
|
||||||
|
|
||||||
# https://www.raspberrypi.org/documentation/remote-access/web-server/nginx.md
|
# https://www.raspberrypi.org/documentation/remote-access/web-server/nginx.md
|
||||||
|
|
||||||
|
# check for certbot and nginx
|
||||||
|
if dpkg -l | grep -qw "certbot"; then
|
||||||
|
echo "# certbot is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y certbot
|
||||||
|
fi
|
||||||
|
if dpkg -l | grep -qw "nginx"; then
|
||||||
|
echo "# nginx is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y nginx
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "***"
|
echo "***"
|
||||||
echo "Please confirm that the port 80 is forwarded to the IP of the RaspiBlitz by pressing [ENTER]"
|
echo "Please confirm that the port 80 is forwarded to the IP of the RaspiBlitz by pressing [ENTER]"
|
||||||
@@ -74,7 +85,6 @@ RestartSec=60
|
|||||||
|
|
||||||
sudo systemctl enable certbot.timer
|
sudo systemctl enable certbot.timer
|
||||||
|
|
||||||
|
|
||||||
echo "Setting up nginx.conf"
|
echo "Setting up nginx.conf"
|
||||||
echo "***"
|
echo "***"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -3,6 +3,18 @@
|
|||||||
# WORK IN PROGRESS
|
# WORK IN PROGRESS
|
||||||
# see https://gist.github.com/NicolasDorier/1a7fce6836ee55a7fa2c7f65417b88b5
|
# see https://gist.github.com/NicolasDorier/1a7fce6836ee55a7fa2c7f65417b88b5
|
||||||
|
|
||||||
|
# check for certbot and nginx
|
||||||
|
if dpkg -l | grep -qw "certbot"; then
|
||||||
|
echo "# certbot is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y certbot
|
||||||
|
fi
|
||||||
|
if dpkg -l | grep -qw "nginx"; then
|
||||||
|
echo "# nginx is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y nginx
|
||||||
|
fi
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
Input your email:
|
Input your email:
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# check for certbot and nginx
|
||||||
|
if dpkg -l | grep -qw "certbot"; then
|
||||||
|
echo "# certbot is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y certbot
|
||||||
|
fi
|
||||||
|
if dpkg -l | grep -qw "nginx"; then
|
||||||
|
echo "# nginx is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y nginx
|
||||||
|
fi
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
Input your email:
|
Input your email:
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# check for certbot and nginx
|
||||||
|
if dpkg -l | grep -qw "certbot"; then
|
||||||
|
echo "# certbot is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y certbot
|
||||||
|
fi
|
||||||
|
if dpkg -l | grep -qw "nginx"; then
|
||||||
|
echo "# nginx is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y nginx
|
||||||
|
fi
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
Input your email:
|
Input your email:
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# check for certbot and nginx
|
||||||
|
if dpkg -l | grep -qw "certbot"; then
|
||||||
|
echo "# certbot is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y certbot
|
||||||
|
fi
|
||||||
|
if dpkg -l | grep -qw "nginx"; then
|
||||||
|
echo "# nginx is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y nginx
|
||||||
|
fi
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
Input your email:
|
Input your email:
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# check for certbot and nginx
|
||||||
|
if dpkg -l | grep -qw "certbot"; then
|
||||||
|
echo "# certbot is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y certbot
|
||||||
|
fi
|
||||||
|
if dpkg -l | grep -qw "nginx"; then
|
||||||
|
echo "# nginx is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y nginx
|
||||||
|
fi
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
Input your email:"
|
Input your email:"
|
||||||
read EMAIL
|
read EMAIL
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# check for certbot and nginx
|
||||||
|
if dpkg -l | grep -qw "certbot"; then
|
||||||
|
echo "# certbot is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y certbot
|
||||||
|
fi
|
||||||
|
if dpkg -l | grep -qw "nginx"; then
|
||||||
|
echo "# nginx is already installed"
|
||||||
|
else
|
||||||
|
sudo apt install -y nginx
|
||||||
|
fi
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
Input your email:
|
Input your email:
|
||||||
"
|
"
|
||||||
@@ -24,8 +36,8 @@ eg.: /nostrrelay/nNZ59JFH
|
|||||||
read RELAY
|
read RELAY
|
||||||
|
|
||||||
sudo certbot certonly -a standalone -m $EMAIL --agree-tos \
|
sudo certbot certonly -a standalone -m $EMAIL --agree-tos \
|
||||||
-d $SUBDOMAIN --expand -n --pre-hook "service nginx stop" \
|
-d $SUBDOMAIN --expand -n --pre-hook "service nginx stop" \
|
||||||
--post-hook "service nginx start" || exit 1
|
--post-hook "service nginx start" || exit 1
|
||||||
|
|
||||||
# copy in place on a remote machine if needed
|
# copy in place on a remote machine if needed
|
||||||
#sudo cat /etc/letsencrypt/live/$SUBDOMAIN/fullchain.pem
|
#sudo cat /etc/letsencrypt/live/$SUBDOMAIN/fullchain.pem
|
||||||
@@ -51,29 +63,21 @@ server {
|
|||||||
ssl_trusted_certificate /etc/letsencrypt/live/$SUBDOMAIN/chain.pem;
|
ssl_trusted_certificate /etc/letsencrypt/live/$SUBDOMAIN/chain.pem;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass https://${SUBDOMAIN}${RELAY};
|
proxy_pass ${SERVER}${RELAY};
|
||||||
# to allow wss:// connections
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade \$http_upgrade;
|
|
||||||
proxy_set_header Connection \"upgrade\";
|
|
||||||
|
|
||||||
# from https://github.com/rootzoll/raspiblitz/blob/v1.7/home.admin/assets/nginx/snippets/ssl-proxy-params.conf
|
# WebSocket support
|
||||||
proxy_SERVER off;
|
|
||||||
proxy_set_header Host \$http_host;
|
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto https;
|
|
||||||
}
|
|
||||||
|
|
||||||
location $RELAY {
|
|
||||||
proxy_pass $SERVER;
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade \$http_upgrade;
|
proxy_set_header Upgrade \$http_upgrade; # Upgrade header for WebSocket
|
||||||
proxy_set_header Connection \"upgrade\";
|
proxy_set_header Connection \"upgrade\"; # Connection header for WebSocket
|
||||||
|
|
||||||
|
# Additional headers
|
||||||
proxy_set_header Host \$host;
|
proxy_set_header Host \$host;
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
|
||||||
|
# Disable proxy redirects
|
||||||
|
proxy_redirect off;
|
||||||
}
|
}
|
||||||
}" | sudo tee /etc/nginx/sites-available/$SUBDOMAIN
|
}" | sudo tee /etc/nginx/sites-available/$SUBDOMAIN
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user