removed phpVersion, detect php socket file from www.conf or leave tag
This commit is contained in:
parent
5e03527996
commit
b476a8becf
8
.vscode/numbered-bookmarks.json
vendored
8
.vscode/numbered-bookmarks.json
vendored
@ -4,15 +4,15 @@
|
||||
"fsPath": "$ROOTPATH$/setup.sh",
|
||||
"bookmarks": [
|
||||
-1,
|
||||
31,
|
||||
45,
|
||||
704,
|
||||
30,
|
||||
44,
|
||||
690,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
179
|
||||
682
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -1,4 +1,4 @@
|
||||
# PHP handler (socket)
|
||||
upstream php-handler {
|
||||
server unix:/run/php/php<phpVersion>-fpm.sock;
|
||||
server unix:<phpSock>;
|
||||
}
|
44
setup.sh
44
setup.sh
@ -25,7 +25,6 @@ unset CertPath
|
||||
unset KeyPath
|
||||
unset CAChainPath
|
||||
unset DHPath
|
||||
unset phpVersion
|
||||
unset phpType
|
||||
unset noOSCP
|
||||
|
||||
@ -59,10 +58,10 @@ 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"
|
||||
file_phpSock="nginx/nginx_conf_phphandler_SOCK.insert"
|
||||
tag_phpAddr="<phpAddr>"
|
||||
tag_phpPort="<phpPort>"
|
||||
tag_phpVersion="<phpVersion>"
|
||||
tag_phpSock="<phpSock>"
|
||||
|
||||
|
||||
|
||||
@ -520,30 +519,6 @@ while true; do
|
||||
esac
|
||||
done
|
||||
|
||||
# get PHP-FPM version
|
||||
if [ "${usePHP}" -eq 1 ]; then
|
||||
while true; do
|
||||
read -p "What version of PHP-FPM are you using? (default: 7.2) " inputPHPVersion
|
||||
case $inputPHPVersion in
|
||||
[[:digit:]]*|+[[:digit:]]*.[[:digit:]]*)
|
||||
phpVersion="$inputPHPVersion"
|
||||
break
|
||||
;;
|
||||
'')
|
||||
phpVersion=7.2
|
||||
break
|
||||
;;
|
||||
[Xx]*)
|
||||
echo -e "\n${cyan}---exiting---\n${norm}"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e "\n${err}That does not seem to be a valid version number${norm}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
# get PHP-FPM TCP or Sockets configuration
|
||||
if [ "${usePHP}" -eq 1 ]; then
|
||||
echo -e "\n${mag}PHP-FPM can be set up to respond to requests via TCP or via UNIX sockets."
|
||||
@ -619,6 +594,17 @@ if [ "${phpType}" = "tcp" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
# get PHP-FPM socket file from www.conf
|
||||
if [ "${phpType}" = "sockets" ]; then
|
||||
phpSock=$(find /etc/php/ -name 'www.conf' -type f -exec grep 'listen.*sock$' {} + | sed 's/.*=\ //')
|
||||
# check if phpSock is null
|
||||
if [ -z "${phpSock}" ]; then
|
||||
echo -e "\n${err}Could not auto-detect socket file name${norm}"
|
||||
echo -e "PHP handler will be set up but you will have to edit ${warn}nginx.conf${norm}"
|
||||
echo -e "manually to include the proper socket-file name where you see ${warn}<phpSock>${norm}\n"
|
||||
phpSock='<phpSock>'
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
### notify user and generate DHParms if necessary
|
||||
@ -692,9 +678,9 @@ fi
|
||||
if [ "${phpType}" = "sockets" ]; then
|
||||
echo -e "updating ${warn}${configPath}/${file_phphandler}${norm}"
|
||||
# update .insert tag with version number
|
||||
sed -i "s/${tag_phpVersion}/${phpVersion}/" "${configPath}/${file_phpSOCK}"
|
||||
sed -i "s/${tag_phpSock}/${phpSock}/" "${configPath}/${file_phpSock}"
|
||||
# copy .insert file into nginx.conf
|
||||
sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpSOCK}" -e 'd}' "${configPath}/${file_phphandler}"
|
||||
sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpSock}" -e 'd}' "${configPath}/${file_phphandler}"
|
||||
fi
|
||||
|
||||
# notify user file updates are completed
|
||||
|
Loading…
Reference in New Issue
Block a user