subst PHP-handler into nginx.conf
This commit is contained in:
parent
f3583f74b2
commit
2468418a64
6
.vscode/numbered-bookmarks.json
vendored
6
.vscode/numbered-bookmarks.json
vendored
@ -4,15 +4,15 @@
|
|||||||
"fsPath": "$ROOTPATH$/setup.sh",
|
"fsPath": "$ROOTPATH$/setup.sh",
|
||||||
"bookmarks": [
|
"bookmarks": [
|
||||||
-1,
|
-1,
|
||||||
17,
|
30,
|
||||||
39,
|
42,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
545
|
563
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
### This is what the script should insert if PHP is selected
|
|
||||||
|
|
||||||
## TCP option -- address and port should be variables, default here
|
|
||||||
## blank line after closing brace is intentional
|
|
||||||
# PHP handler (tcp)
|
|
||||||
upstream php-handler {
|
|
||||||
server 127.0.0.1:9000;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
## Socket option -- php version should be variable, default here
|
|
||||||
## blank line after closing brace is intentional
|
|
||||||
|
|
||||||
# PHP handler (socket)
|
|
||||||
upstream php-handler {
|
|
||||||
server unix:/run/php/php7.2-fpm.sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for sed:
|
|
||||||
append after root.*;$
|
|
4
etc/nginx/nginx_conf_phphandler_SOCK.insert
Normal file
4
etc/nginx/nginx_conf_phphandler_SOCK.insert
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# PHP handler (socket)
|
||||||
|
upstream php-handler {
|
||||||
|
server unix:/run/php/php7.2-fpm.sock;
|
||||||
|
}
|
4
etc/nginx/nginx_conf_phphandler_TCP.insert
Normal file
4
etc/nginx/nginx_conf_phphandler_TCP.insert
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# PHP handler (tcp)
|
||||||
|
upstream php-handler {
|
||||||
|
server 127.0.0.1:9000;
|
||||||
|
}
|
17
setup.sh
17
setup.sh
@ -51,7 +51,10 @@ tag_cachain="<path/to/your_CA_bundle.crt>"
|
|||||||
file_mozmodern="nginx/conf.d/mozModern_ssl.conf"
|
file_mozmodern="nginx/conf.d/mozModern_ssl.conf"
|
||||||
file_buffers="nginx/conf.d/buffers.conf"
|
file_buffers="nginx/conf.d/buffers.conf"
|
||||||
file_buffersPHP="nginx/conf.d/buffers_conf_php.insert"
|
file_buffersPHP="nginx/conf.d/buffers_conf_php.insert"
|
||||||
|
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"
|
||||||
|
|
||||||
### quick intro for the user
|
### quick intro for the user
|
||||||
echo -e "\n${mag}This script will customize the provided NGINX template files for your"
|
echo -e "\n${mag}This script will customize the provided NGINX template files for your"
|
||||||
@ -552,6 +555,18 @@ if [ "${usePHP}" -eq 1 ]; then
|
|||||||
cat "${configPath}/${file_buffersPHP}" >> "${configPath}/${file_buffers}"
|
cat "${configPath}/${file_buffersPHP}" >> "${configPath}/${file_buffers}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if using PHP-TCP: add upstream handler in nginx.conf
|
||||||
|
if [ "${phpType}" = "tcp" ]; then
|
||||||
|
echo "updating ${warn}${configPath}/${file_phphandler}${norm}"
|
||||||
|
sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpTCP}" -e 'd}' "${configPath}/${file_phphandler}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if using PHP-SOCK: add upstream handler in nginx.conf
|
||||||
|
if [ "${phpType}" = "sockets" ]; then
|
||||||
|
echo "updating ${warn}${configPath}/${file_phphandler}${norm}"
|
||||||
|
sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpSOCK}" -e 'd}' "${configPath}/${file_phphandler}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# debug section
|
# debug section
|
||||||
echo -e "\n${mag}---------------------${norm}"
|
echo -e "\n${mag}---------------------${norm}"
|
||||||
|
Loading…
Reference in New Issue
Block a user