From df38331df3befe62527334e465635c860dc5eb4a Mon Sep 17 00:00:00 2001 From: openoms Date: Tue, 9 Jun 2020 21:18:47 +0100 Subject: [PATCH] btcrpcexplorer: nginx integration --- .../sites-available/btcrpcexplorer_ssl.conf | 20 +++++++++++ .../sites-available/btcrpcexplorer_tor.conf | 17 +++++++++ .../btcrpcexplorer_tor_ssl.conf | 20 +++++++++++ .../config.scripts/bonus.btc-rpc-explorer.sh | 35 ++++++++++++++++--- 4 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 home.admin/assets/nginx/sites-available/btcrpcexplorer_ssl.conf create mode 100644 home.admin/assets/nginx/sites-available/btcrpcexplorer_tor.conf create mode 100644 home.admin/assets/nginx/sites-available/btcrpcexplorer_tor_ssl.conf diff --git a/home.admin/assets/nginx/sites-available/btcrpcexplorer_ssl.conf b/home.admin/assets/nginx/sites-available/btcrpcexplorer_ssl.conf new file mode 100644 index 000000000..51ec38ca6 --- /dev/null +++ b/home.admin/assets/nginx/sites-available/btcrpcexplorer_ssl.conf @@ -0,0 +1,20 @@ +## btcrpcexplorer_ssl.conf + +server { + listen 3021 ssl; + listen [::]:3021 ssl; + server_name _; + + include /etc/nginx/snippets/ssl-params.conf; + include /etc/nginx/snippets/ssl-certificate-app-data.conf; + + access_log /var/log/nginx/access_thub.log; + error_log /var/log/nginx/error_thub.log; + + location / { + proxy_pass http://127.0.0.1:3020; + + include /etc/nginx/snippets/ssl-proxy-params.conf; + } + +} diff --git a/home.admin/assets/nginx/sites-available/btcrpcexplorer_tor.conf b/home.admin/assets/nginx/sites-available/btcrpcexplorer_tor.conf new file mode 100644 index 000000000..5f30cb12e --- /dev/null +++ b/home.admin/assets/nginx/sites-available/btcrpcexplorer_tor.conf @@ -0,0 +1,17 @@ +## btcrpcexplorer_tor.conf + +server { + listen localhost:3022; + listen [::1]:3022; + server_name _; + + access_log /var/log/nginx/access_thub.log; + error_log /var/log/nginx/error_thub.log; + + location / { + proxy_pass http://127.0.0.1:3020; + + include /etc/nginx/snippets/ssl-proxy-params.conf; + } + +} diff --git a/home.admin/assets/nginx/sites-available/btcrpcexplorer_tor_ssl.conf b/home.admin/assets/nginx/sites-available/btcrpcexplorer_tor_ssl.conf new file mode 100644 index 000000000..93f8d6d5c --- /dev/null +++ b/home.admin/assets/nginx/sites-available/btcrpcexplorer_tor_ssl.conf @@ -0,0 +1,20 @@ +## btcrpcexplorer_tor_ssl.conf + +server { + listen localhost:3023 ssl; + listen [::1]:3023 ssl; + server_name _; + + include /etc/nginx/snippets/ssl-params.conf; + include /etc/nginx/snippets/ssl-certificate-app-data.conf; + + access_log /var/log/nginx/access_thub.log; + error_log /var/log/nginx/error_thub.log; + + location / { + proxy_pass http://127.0.0.1:3020; + + include /etc/nginx/snippets/ssl-proxy-params.conf; + } + +} diff --git a/home.admin/config.scripts/bonus.btc-rpc-explorer.sh b/home.admin/config.scripts/bonus.btc-rpc-explorer.sh index 8ec8f5945..9b6aafb2b 100644 --- a/home.admin/config.scripts/bonus.btc-rpc-explorer.sh +++ b/home.admin/config.scripts/bonus.btc-rpc-explorer.sh @@ -159,6 +159,26 @@ EOF sudo ufw allow 3020 comment 'btc-rpc-explorer' echo "" + + ################## + # NGINX + ################## + # setup nginx symlinks + if ! [ -f /etc/nginx/sites-available/btcrpcexplorer_ssl.conf ]; then + sudo cp /home/admin/assets/nginx/sites-available/btcrpcexplorer_ssl.conf /etc/nginx/sites-available/btcrpcexplorer_ssl.conf + fi + if ! [ -f /etc/nginx/sites-available/btcrpcexplorer_tor.conf ]; then + sudo cp /home/admin/assets/nginx/sites-available/btcrpcexplorer_tor.conf /etc/nginx/sites-available/btcrpcexplorer_tor.conf + fi + if ! [ -f /etc/nginx/sites-available/btcrpcexplorer_tor_ssl.conf ]; then + sudo cp /home/admin/assets/nginx/sites-available/btcrpcexplorer_tor_ssl.conf /etc/nginx/sites-available/btcrpcexplorer_tor_ssl.conf + fi + sudo ln -sf /etc/nginx/sites-available/btcrpcexplorer_ssl.conf /etc/nginx/sites-enabled/ + sudo ln -sf /etc/nginx/sites-available/btcrpcexplorer_tor.conf /etc/nginx/sites-enabled/ + sudo ln -sf /etc/nginx/sites-available/btcrpcexplorer_tor_ssl.conf /etc/nginx/sites-enabled/ + sudo nginx -t + sudo systemctl reload nginx + # install service echo "*** Install btc-rpc-explorer systemd ***" cat > /home/admin/btc-rpc-explorer.service <