nginx-basic/setup.sh

36 lines
1014 B
Bash
Raw Normal View History

2019-01-04 22:04:29 -07:00
#!/bin/bash
#######
### Update NGINX configuration '<tags>' with proper values and optionally copy
### to updated directory structure
#######
# text formatting ansi codes
err="\e[1;31m"
ok="\e[1;32m"
warn="\e[93m"
mag="\e[95m"
cyan="\e[96m"
norm="\e[0m"
# set variables
detectedIP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')
regexIP4="(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])"
# quick intro for the user
echo -e "\n${mag}This script will customize the provided NGINX template files for your"
echo "environment. You will be prompted for all necessary information. After that,"
echo "default error pages will be copied to your webroot and your NGINX configuration"
echo -e "directory structure will be customized.${norm}\n"
echo -e "${warn}You may accept the default option (listed in brackets) by simply"
echo "pressing ENTER (i.e. no answer)."
echo -e "You may exit this script at any prompt by typing 'X'${norm}\n"
exit 0