update
This commit is contained in:
@@ -99,15 +99,12 @@ DEL-SSL(){
|
||||
rm -rf ${NM_CERTPATH}/archive/${DEL_SSL}
|
||||
rm -rf ${NM_CERTPATH}/live/${DEL_SSL}
|
||||
rm -f ${NM_CERTPATH}/renewal/${DEL_SSL}.conf
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
echo
|
||||
|
||||
|
||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||
echo -e "\n${idsCL[LightRed]}The SSL certificate has been fully removed from the node(s).${idsCL[Default]}"
|
||||
else
|
||||
echo -e "${idsCL[LightRed]}The SSL files folder for '${idsCL[Red]}${DEL_SSL}${idsCL[LightRed]}' could not be found.${idsCL[Default]}"
|
||||
echo -e "\n${idsCL[LightRed]}The SSL files folder for '${idsCL[Red]}${DEL_SSL}${idsCL[LightRed]}' could not be found.${idsCL[Default]}"
|
||||
fi
|
||||
echo
|
||||
echo -e "${idsCL[LightRed]}The SSL certificate has been fully removed from the node(s).${idsCL[Default]}"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -495,52 +495,66 @@ NEWPROXYSITE_CREATE(){
|
||||
echo -e "\n${idsCL[LightRed]}New site name already exists!${idsCL[Default]}\n"
|
||||
exit 1
|
||||
else
|
||||
# [ "${MAIN_SITE}" != "${SITENAME}" ] && mv ${NM_NGINXPATH}/sites-enabled/${SITENAME}.conf ${nginxconfig}
|
||||
[ "${MAIN_SITE}" != "${SITENAME}" ] && [ -f ${NM_NGINXPATH}/sites-enabled/${SITENAME}.conf ] && mv ${NM_NGINXPATH}/sites-enabled/${SITENAME}.conf ${nginxconfig}
|
||||
if [ ! -f ${nginxconfig} ]; then
|
||||
cp ${NM_FOLDER}/templates/nginx.proxy.site ${nginxconfig}
|
||||
sed -i "s/<<SERVER_NAME>>/${SERVERNAMES//,/ }/g" ${nginxconfig}
|
||||
sed -i "s/<<MAIN_SITE>>/${MAIN_SITE}/g" ${nginxconfig}
|
||||
sed -i "s/<<PROXY_IP>>/${PROXYHOST}/g" ${nginxconfig}
|
||||
sed -i "s/<<PROXY_PORT>>/${PROXYPORT}/g" ${nginxconfig}
|
||||
sed -i "s/<<PROXY_SCHEME>>/${PROXYSCHEME}/g" ${nginxconfig}
|
||||
sed -i "s%<<NM_CERTPATH>>%${NM_CERTPATH}%g" ${nginxconfig}
|
||||
|
||||
else
|
||||
oldservernames=$(grep 'server_name' ${nginxconfig});oldservernames=${oldservernames//;/};oldservernames=${soldservernames#* };oldservernames=${oldservernames// /,}
|
||||
if [ "${MAIN_SITE}" != "${SITENAME}" ]; then
|
||||
echo -en "\n${idsCL[LightCyan]}Removing old SSL Cert ... "
|
||||
DEL-SSL ${SITENAME} >/dev/null 2>&1
|
||||
echo -e "${idsCL[LightGreen]}Done${idsCL[Default]}\n"
|
||||
echo -en "\n${idsCL[LightCyan]}Requesting new SSL Cert ... "
|
||||
NEWCERT ${SERVERNAMES} >/dev/null 2>&1
|
||||
echo -e "${idsCL[LightGreen]}Done${idsCL[Default]}\n"
|
||||
sed -i "s/live\/${SITENAME}\//live\/${MAIN_SITE}\//g" ${nginxconfig}
|
||||
|
||||
sed -i "/set \$forward_scheme/d" ${nginxconfig}; sed -i "/server {/a\\\tset \$forward_scheme ${PROXYSCHEME};" ${nginxconfig}
|
||||
sed -i "/set \$server/d" ${nginxconfig}; sed -i "/set \$forward_scheme/a\\\tset \$server \"${PROXYHOST}\";" ${nginxconfig}
|
||||
sed -i "/set \$port/d" ${nginxconfig}; sed -i "/set \$server/a\\\tset \$port ${PROXYPORT};" ${nginxconfig}
|
||||
sed -i "/server_name/,+1 d" ${nginxconfig}; sed -i "/set \$port/a\\\n\tserver_name ${SERVERNAMES//,/ };" ${nginxconfig}
|
||||
|
||||
if [ "${SECURE}" != "-" ]; then
|
||||
elif [ "${oldservernames}" != "${SERVERNAMES}" ]; then
|
||||
echo -e "\n${idsCL[LightCyan]}Updating SSL Cert for hostname changes, select to 'Update' when prompted:"
|
||||
NEWCERT ${SERVERNAMES}
|
||||
echo -e "${idsCL[LightGreen]}Done${idsCL[Default]}\n"
|
||||
else
|
||||
|
||||
fi
|
||||
sed -i "/set \$forward_scheme/d" ${nginxconfig}; sed -i "/server {/a\\\tset \$forward_scheme ${PROXYSCHEME};" ${nginxconfig}
|
||||
sed -i "/set \$server/d" ${nginxconfig}; sed -i "/set \$forward_scheme/a\\\tset \$server \"${PROXYHOST}\";" ${nginxconfig}
|
||||
sed -i "/set \$port/d" ${nginxconfig}; sed -i "/set \$server/a\\\tset \$port ${PROXYPORT};" ${nginxconfig}
|
||||
sed -i "/server_name/,+1 d" ${nginxconfig}; sed -i "/set \$port/a\\\n\tserver_name ${SERVERNAMES//,/ };" ${nginxconfig}
|
||||
fi
|
||||
|
||||
|
||||
if [ "${SECURE}" == "Yes" ]; then
|
||||
sed -i "s/#include conf.d\/include\/secure-access.conf/include conf.d\/include\/secure-access.conf/g" ${nginxconfig}
|
||||
else
|
||||
sed -i "s/include conf.d\/include\/secure-access.conf/#include conf.d\/include\/secure-access.conf/g" ${nginxconfig}
|
||||
fi
|
||||
if [ "${WEBSOCKET}" != "-" ]; then
|
||||
if [ "${WEBSOCKET}" == "Yes" ]; then
|
||||
sed -i "s/#include conf.d\/include\/websocket-support.conf/include conf.d\/include\/websocket-support.conf/g" ${nginxconfig}
|
||||
else
|
||||
sed -i "s/include conf.d\/include\/websocket-support.conf/#include conf.d\/include\/websocket-support.conf/g" ${nginxconfig}
|
||||
fi
|
||||
if [ "${HSTS}" != "-" ]; then
|
||||
if [ "${HSTS}" == "Yes" ]; then
|
||||
sed -i "s/#include conf.d\/include\/hsts-support.conf/include conf.d\/include\/hsts-support.conf/g" ${nginxconfig}
|
||||
else
|
||||
sed -i "s/include conf.d\/include\/hsts-support.conf/#include conf.d\/include\/hsts-support.conf/g" ${nginxconfig}
|
||||
fi
|
||||
if [ "${EXPLOITS}" != "-" ]; then
|
||||
if [ "${EXPLOITS}" == "Yes" ]; then
|
||||
sed -i "s/#include conf.d\/include\/block-exploits.conf/include conf.d\/include\/block-exploits.conf/g" ${nginxconfig}
|
||||
else
|
||||
sed -i "s/include conf.d\/include\/block-exploits.conf/#include conf.d\/include\/block-exploits.conf/g" ${nginxconfig}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
sed -i "s/##include/#include/g" ${nginxconfig}
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# cp ${NM_FOLDER}/templates/nginx.proxy.site ${nginxconfig}
|
||||
# sed -i "s/<<SERVER_NAME>>/${NGINX_SERVERNAME}/g" ${nginxconfig}
|
||||
# sed -i "s/<<MAIN_SITE>>/${MAIN_SITE}/g" ${nginxconfig}
|
||||
# sed -i "s/<<PROXY_IP>>/${PROXYHOST}/g" ${nginxconfig}
|
||||
# sed -i "s/<<PROXY_PORT>>/${PROXYPORT}/g" ${nginxconfig}
|
||||
# sed -i "s/<<PROXY_SCHEME>>/${PROXYSCHEME}/g" ${nginxconfig}
|
||||
# sed -i "s/<<WEBSOCKET>>/${WEBSOCKET}/g" ${nginxconfig}
|
||||
# sed -i "s/<<HSTS>>/${HSTS}/g" ${nginxconfig}
|
||||
# sed -i "s/<<EXPLOITS>>/${EXPLOITS}/g" ${nginxconfig}
|
||||
# sed -i "s/<<SECURE>>/${SECURE}/g" ${nginxconfig}
|
||||
}
|
||||
|
||||
SITEINFO(){
|
||||
|
||||
Reference in New Issue
Block a user