From 55e77cf73d7f50b747bc2b81bb0819b42d1853c3 Mon Sep 17 00:00:00 2001 From: fro Date: Tue, 28 Oct 2025 15:24:32 -0500 Subject: [PATCH] + 8_nginx_enable_site.sh --- scr/0_download_scripts.sh | 1 + scr/8_nginx_enable_site.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 scr/8_nginx_enable_site.sh diff --git a/scr/0_download_scripts.sh b/scr/0_download_scripts.sh index 78e393f..69fd371 100755 --- a/scr/0_download_scripts.sh +++ b/scr/0_download_scripts.sh @@ -33,5 +33,6 @@ wget ${base_url_scr}/4_acmesh.sh wget ${base_url_scr}/5_https.sh wget ${base_url_scr}/6_add_www_root.sh wget ${base_url_scr}/7_add_www_placeholder.sh +wget ${base_url_scr}/8_nginx_enable_site.sh chmod 755 /tmp/*.sh diff --git a/scr/8_nginx_enable_site.sh b/scr/8_nginx_enable_site.sh new file mode 100755 index 0000000..9d7c38d --- /dev/null +++ b/scr/8_nginx_enable_site.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# enable a specific site in nginx / frode klevstul / oct 2025 +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +if [ "$EUID" -ne 0 ] + then echo "error: run as 'root'" + exit +fi + +this_file_name=`basename "$0"` + +if [ $# -ne 2 ]; then + echo usage: $this_file_name [USERNAME] [BARE_DOMAIN] + exit 1 +fi + +username=$1 +domain=$2 + +cd /tmp/ +trash-put ${domain.conf} +wget https://gt.op.fo/fro/lnxPub/raw/branch/master/srv/cmn/cfg/${domain}.conf +cp /tmp/${domain}.conf /etc/nginx/sites-available/. +ln -s /etc/nginx/sites-available/${domain}.conf /etc/nginx/sites-enabled/ +chown ${username}:${username} /etc/nginx/sites-available/${domain}.conf +nginx -t && systemctl restart nginx