30 lines
790 B
Bash
Executable File
30 lines
790 B
Bash
Executable File
#!/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
|
|
|
|
clear
|
|
|
|
cd /tmp/
|
|
wget -O ${domain}.conf https://gi.op.fo/fro/srv-pub/raw/branch/trunk/cfg/ngx/${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
|