Files
srv-pub/scr/8_nginx_enable_site.sh

30 lines
790 B
Bash
Raw Normal View History

2025-10-28 15:24:32 -05:00
#!/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
2025-10-29 06:08:43 -05:00
clear
2025-10-28 15:24:32 -05:00
cd /tmp/
2025-12-09 19:44:28 -05:00
wget -O ${domain}.conf https://gi.op.fo/fro/srv-pub/raw/branch/trunk/cfg/ngx/${domain}.conf
2025-10-28 15:24:32 -05:00
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