SHARE
TWEET

Untitled

a guest Jan 20th, 2020 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if [[ $EUID -ne 0 ]]; then
  2.    echo "This script must be run as root"
  3.    exit 1
  4. fi
  5. if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then
  6.     echo "Usage: create_server.sh <domain name> <apache port> <websocket port>"
  7.     exit 1
  8. fi
  9. conf_filename=/etc/nginx/servers/$1.conf
  10. sed -e "s/<domain_name>/$1/g; s/<apache_port>/$2/g; s/<ws_port>/$3/g" /etc/nginx/servers/server.template > $conf_filename
  11. if [[ "$?" -ne "0" ]]; then
  12.     echo "Oops, something went wrong."
  13.     exit 1
  14. fi
  15. echo "Config was saved to $conf_filename."
  16. echo "Reloading nginx config..."
  17. systemctl restart nginx
  18. echo "Domain $1 successfully added."
  19. exit
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top