From cea485133f5f182260ce3ec90da68bd1154590f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Fri, 4 Aug 2023 22:44:58 +0800 Subject: [PATCH] fix: website ssl and php --- public/panel/views/website/edit.html | 9 +++++++++ scripts/php/install.sh | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/public/panel/views/website/edit.html b/public/panel/views/website/edit.html index ce91231a..3f00efb4 100644 --- a/public/panel/views/website/edit.html +++ b/public/panel/views/website/edit.html @@ -316,6 +316,15 @@ Date: 2023-07-24 let domains = $("input[name='domains[]']").map(function () { return $(this).val(); }).get() + var reg = new RegExp(/\n443.*\n?/); + // 如果开启了https,就自动添加443端口 + if ($('input[name="ssl"]').prop('checked') && !reg.test(ports)) { + ports = ports + '\n443 ssl http2'; + } + // 如果关闭了https,就自动删除443端口 + if (!$('input[name="ssl"]').prop('checked') && reg.test(ports)) { + ports = ports.replace(/443.*\n?/, ''); + } admin.req({ url: '/api/panel/website/config' diff --git a/scripts/php/install.sh b/scripts/php/install.sh index 0ada91bc..6cdfa9d0 100644 --- a/scripts/php/install.sh +++ b/scripts/php/install.sh @@ -223,8 +223,8 @@ sed -i 's/display_errors = Off/display_errors = On/g' ${phpPath}/etc/php.ini sed -i 's/error_reporting =.*/error_reporting = E_ALL \& \~E_NOTICE/g' ${phpPath}/etc/php.ini # 设置SSL根证书 -sed -i "s#;openssl.cafile=#openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt#" ${phpPath}/etc/php.ini -sed -i "s#;curl.cainfo =#curl.cainfo = /etc/pki/tls/certs/ca-bundle.crt#" ${phpPath}/etc/php.ini +#sed -i "s#;openssl.cafile=#openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt#" ${phpPath}/etc/php.ini +#sed -i "s#;curl.cainfo =#curl.cainfo = /etc/pki/tls/certs/ca-bundle.crt#" ${phpPath}/etc/php.ini # 关闭php外显 sed -i 's/expose_php = On/expose_php = Off/g' ${phpPath}/etc/php.ini