Root repository and issue tracker for Monarch-Pass.net services, except Glitch City Laboratories and Infinitypedia
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
563 B

#!/bin/bash
SERVER_NAME=$1
PORT=$2
NGINX_CONFIG=/etc/nginx
AVAILABLE_SITES="$NGINX_CONFIG/sites-available"
ENABLED_SITES="$NGINX_CONFIG/sites-enabled"
NGINX_CONF_TEMPLATE=nginx.conf.template
NGINX_CONF_NAME="$SERVER_NAME.conf"
NGINX_LOGS=/var/log/nginx
cp $NGINX_CONF_TEMPLATE "$AVAILABLE_SITES/$NGINX_CONF_NAME"
cd $AVAILABLE_SITES
sed -i "s/@SERVER_NAME@/$SERVER_NAME/g" $NGINX_CONF_NAME
sed -i "s/@PORT@/$PORT/g" $NGINX_CONF_NAME
cd $ENABLED_SITES
ln -s "../sites-available/$NGINX_CONF_NAME" .
mkdir -p "$NGINX_LOGS/$SERVER_NAME"
service nginx reload