+ 8_nginx_enable_site.sh

This commit is contained in:
fro
2025-10-28 15:24:32 -05:00
parent d6e16a7eec
commit 55e77cf73d
2 changed files with 29 additions and 0 deletions

View File

@@ -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

28
scr/8_nginx_enable_site.sh Executable file
View File

@@ -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