copy configuration to /etc/nginx and exit

This commit is contained in:
Asif Bacchus 2019-01-08 22:26:18 -07:00
parent 7376a1abe7
commit 0479563690
2 changed files with 34 additions and 2 deletions

View File

@ -6,13 +6,13 @@
-1,
19,
54,
787,
819,
68,
-1,
-1,
-1,
-1,
-1
810
]
}
]

View File

@ -784,6 +784,38 @@ fi
echo -e "${ok}...files updated${norm}"
echo -e "${mag}---------------------${norm}\n"
### copy configDir to actual nginx directory after backup
## backup nginx directory
echo -e "${cyan}Backing up NGINX configuration directory${norm}"
echo "copying /etc/nginx --> /etc/nginx.original"
cp -f -R /etc/nginx /etc/nginx.original
copysuccess=$?
# verify new directory created
if [ "${copysuccess}" -eq 0 ]; then
echo -e "${ok}--- configuration backup successful ---"
else
echo -e "\n${err}Unable to backup existing NGINX configuration${norm}"
echo -e "Updated configuration has been copied to ${warn}${configPath}${norm}"
echo -e "but must be manually integrated into ${warn}'/etc/nginx/'${norm}."
echo "Is this a permissions error?"
echo -e "\n${err}Exiting now.${norm}"
exit 101
fi
echo -e "${cyan}Integrating updated configuration...${norm}"
echo "(any errors should appear below)"
## remove un-needed and/or existing directories and files
rm -rf /etc/nginx/conf.d
rm -rf /etc/nginx/enabledSites
mv -f /etc/nginx/fastcgi_params /etc/nginx/fastcgi_params.original
mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf.original
cp -f -R "${configPath}"/nginx/* /etc/nginx/
mkdir /etc/nginx/enabledSites
mkdir /etc/nginx/conf.d/enabled
echo -e "${ok}...integration completed${norm}"
echo -e "${mag}---------------------${norm}\n"
echo -e "${ok}Setup script completed${norm}"
# debug section
echo -e "\n${mag}---------------------${norm}"