#!/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