#! /usr/bin/env bash WORK_DIR=$(dirname $(realpath $0)) cat > ${WORK_DIR}/nginx.conf << EOF events { worker_connections 768; } http { include ./ledbars.nginx; } EOF nginx -t -c ${WORK_DIR}/nginx.conf || exit 1 rm ${WORK_DIR}/nginx.conf install --backup -m 0644 ${WORK_DIR}/ledbars.nginx /etc/nginx/sites-available/ledbars || exit 2 if [[ ! -L /etc/nginx/sites-enabled/ledbars ]]; then ln -rs /etc/nginx/sites-available/ledbars /etc/nginx/sites-enabled/ fi nginx -s reload