diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 70941e9..aeba5b6 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -4,15 +4,15 @@ "fsPath": "$ROOTPATH$/setup.sh", "bookmarks": [ -1, - 31, - 45, - 704, + 30, + 44, + 690, -1, -1, -1, -1, -1, - 179 + 682 ] } ] diff --git a/etc/nginx/nginx_conf_phphandler_SOCK.insert b/etc/nginx/nginx_conf_phphandler_SOCK.insert index 288e436..0a91f24 100644 --- a/etc/nginx/nginx_conf_phphandler_SOCK.insert +++ b/etc/nginx/nginx_conf_phphandler_SOCK.insert @@ -1,4 +1,4 @@ # PHP handler (socket) upstream php-handler { - server unix:/run/php/php-fpm.sock; + server unix:; } \ No newline at end of file diff --git a/setup.sh b/setup.sh index 60697f1..1c57baa 100755 --- a/setup.sh +++ b/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="#$" 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="" tag_phpPort="" -tag_phpVersion="" +tag_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}${norm}\n" + 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