updated subst php tags for .insert files

This commit is contained in:
Asif Bacchus 2019-01-05 18:31:44 -07:00
parent 9798abde2d
commit ea1f9efef5
2 changed files with 14 additions and 4 deletions

View File

@ -5,14 +5,14 @@
"bookmarks": [
-1,
30,
42,
43,
-1,
-1,
-1,
-1,
-1,
626,
538
636,
625
]
}
]

View File

@ -58,6 +58,9 @@ tag_phphandler="#<insert PHP handler.*>$"
file_phphandler="nginx/nginx.conf"
file_phpTCP="nginx/nginx_conf_phphandler_TCP.insert"
file_phpSOCK="nginx/nginx_conf_phphandler_SOCK.insert"
tag_phpAddr="<phpAddr>"
tag_phpPort="<phpPort>"
tag_phpVersion="<phpVersion>"
### quick intro for the user
echo -e "\n${mag}This script will customize the provided NGINX template files for your"
@ -610,16 +613,23 @@ if [ "${usePHP}" -eq 1 ]; then
cat "${configPath}/${file_buffersPHP}" >> "${configPath}/${file_buffers}"
fi
# if using PHP-TCP: add upstream handler in nginx.conf
## if using PHP-TCP: add upstream handler in nginx.conf
if [ "${phpType}" = "tcp" ]; then
echo "updating ${warn}${configPath}/${file_phphandler}${norm}"
# copy .insert file into nginx.conf
sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpTCP}" -e 'd}' "${configPath}/${file_phphandler}"
# update tags with address and port information
sed -i "s/${tag_phpAddr}/${phpAddr}" "${configPath}/${file_phpTCP}"
sed -i "s/${tag_phpPort}/${phpPort}" "${configPath}/${file_phpTCP}"
fi
# if using PHP-SOCK: add upstream handler in nginx.conf
if [ "${phpType}" = "sockets" ]; then
echo "updating ${warn}${configPath}/${file_phphandler}${norm}"
# copy .insert file into nginx.conf
sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpSOCK}" -e 'd}' "${configPath}/${file_phphandler}"
# update tag with version number
sed -i "s/${tag_phpVersion}/${phpVersion}" "${configPath}/${file_phpSOCK}"
fi