From f4e267ef1bafcd31c18641ffdf9d80ac6973da4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Wed, 26 Jul 2023 15:26:22 +0800 Subject: [PATCH] feat: optimize openresty install --- scripts/openresty/install.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/openresty/install.sh b/scripts/openresty/install.sh index 4e690c1c..59baee74 100644 --- a/scripts/openresty/install.sh +++ b/scripts/openresty/install.sh @@ -320,12 +320,13 @@ chmod -R 644 /www/server/vhost echo "" > ${openrestyPath}/conf/enable-php-0.conf # 自动为所有PHP版本创建配置文件 -cd ${setupPath}/server/php -phpList=$(ls -l | grep ^d | awk '{print $NF}') -for phpVersion in ${phpList}; do - if [ -d "${setupPath}/server/php/${phpVersion}" ]; then - # 写入PHP配置文件 - cat > ${openrestyPath}/conf/enable-php-${phpVersion}.conf << EOF +if [ -d "${setupPath}/server/php" ]; then + cd ${setupPath}/server/php + phpList=$(ls -l | grep ^d | awk '{print $NF}') + for phpVersion in ${phpList}; do + if [ -d "${setupPath}/server/php/${phpVersion}" ]; then + # 写入PHP配置文件 + cat > ${openrestyPath}/conf/enable-php-${phpVersion}.conf << EOF location ~ \.php$ { try_files \$uri =404; fastcgi_pass unix:/tmp/php-cgi-${phpVersion}.sock; @@ -334,8 +335,9 @@ location ~ \.php$ { include pathinfo.conf; } EOF - fi -done + fi + done +fi # 写入代理默认配置文件 cat > ${openrestyPath}/conf/proxy.conf << EOF