From b7086ad7500f2ccf93e17b89eca4b4e30596b217 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Wed, 9 Nov 2022 20:04:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=2080=20302=E9=87=8D?= =?UTF-8?q?=E5=AE=9A=E5=90=91=E3=80=81=E4=BF=AE=E6=94=B9=E6=A0=B9=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E8=AF=81=E4=B9=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 65 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index b84812a..790572b 100644 --- a/install.sh +++ b/install.sh @@ -189,7 +189,7 @@ initVar() { installTLSCount= # BTPanel状态 - BTPanelStatus= + # BTPanelStatus= # nginx配置文件路径 nginxConfigPath=/etc/nginx/conf.d/ @@ -337,7 +337,7 @@ readInstallProtocolType() { checkBTPanel() { if pgrep -f "BT-Panel"; then nginxConfigPath=/www/server/panel/vhost/nginx/ - BTPanelStatus=true + # BTPanelStatus=true fi } # 读取当前alpn的顺序 @@ -918,25 +918,41 @@ EOF # 修改nginx重定向配置 updateRedirectNginxConf() { - if [[ ${BTPanelStatus} == "true" ]]; then - - cat <${nginxConfigPath}alone.conf - server { - listen 127.0.0.1:31300; - server_name _; - return 403; - } -EOF - - elif [[ -n "${customPort}" ]]; then - cat <${nginxConfigPath}alone.conf - server { - listen 127.0.0.1:31300; - server_name _; - return 403; - } -EOF + # if [[ ${BTPanelStatus} == "true" ]]; then + # + # cat <${nginxConfigPath}alone.conf + # server { + # listen 127.0.0.1:31300; + # server_name _; + # return 403; + # } + #EOF + # + # elif [[ -n "${customPort}" ]]; then + # cat <${nginxConfigPath}alone.conf + # server { + # listen 127.0.0.1:31300; + # server_name _; + # return 403; + # } + #EOF + # fi + local redirectDomain=${domain} + if [[ -n "${customPort}" ]]; then + redirectDomain=${domain}:${customPort} fi + cat <${nginxConfigPath}alone.conf +server { + listen 80; + server_name ${domain}; + return 302 https://${redirectDomain}; +} +server { + listen 127.0.0.1:31300; + server_name _; + return 403; +} +EOF if echo "${selectCustomInstallType}" | grep -q 2 && echo "${selectCustomInstallType}" | grep -q 5 || [[ -z "${selectCustomInstallType}" ]]; then @@ -1252,6 +1268,7 @@ customPortFunction() { if [[ -n "${customPort}" ]]; then if ((customPort >= 1 && customPort <= 65535)); then checkCustomPort + allowPort "${customPort}" else echoContent red " ---> 端口输入错误" exit @@ -1259,9 +1276,11 @@ customPortFunction() { else echoContent yellow "\n ---> 端口: 443" fi + else + echoContent yellow "\n ---> 端口: ${currentPort}" fi - } + # 检测端口是否占用 checkCustomPort() { if lsof -i "tcp:${customPort}" | grep -q LISTEN; then @@ -1307,7 +1326,7 @@ installTLS() { if [[ "${installDNSACMEStatus}" == "true" ]]; then echo if [[ -d "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.key" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.cer" ]]; then - sudo "$HOME/.acme.sh/acme.sh" --installcert -d "*.${dnsTLSDomain}" --fullchainpath "/etc/v2ray-agent/tls/${tlsDomain}.crt" --keypath "/etc/v2ray-agent/tls/${tlsDomain}.key" --ecc >/dev/null + sudo "$HOME/.acme.sh/acme.sh" --installcert -d "${dnsTLSDomain}" -d "*.${dnsTLSDomain}" --fullchainpath "/etc/v2ray-agent/tls/${tlsDomain}.crt" --keypath "/etc/v2ray-agent/tls/${tlsDomain}.key" --ecc >/dev/null fi elif [[ -d "$HOME/.acme.sh/${tlsDomain}_ecc" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.key" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.cer" ]]; then @@ -5401,7 +5420,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.6.9" + echoContent green "当前版本:v2.6.10" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus