From a727921608c977bc228bd4ebeaff1d273fb7ad0e Mon Sep 17 00:00:00 2001 From: wulabing Date: Tue, 26 Nov 2019 10:51:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 647ada5..ac42059 100644 --- a/install.sh +++ b/install.sh @@ -518,17 +518,22 @@ judge "Nginx systemd ServerFile 添加" } tls_type(){ - echo "请选择支持的 TLS 版本(default:1):" - echo "1: TLS1.2 and TLS1.3" - echo "2: TLS1.3 only" - read -p "请输入:" tls_version - [[ -z ${tls_version} ]] && tls_version=1 - if [[ $tls_version == 2 ]];then - sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.3;/' $nginx_conf - echo -e "${OK} ${GreenBG} 已切换至 TLS1.3 only ${Font}" + if [[ -f "/etc/nginx/sbin/nginx" ]] && [[ -f "$nginx_conf" ]];then + echo "请选择支持的 TLS 版本(default:1):" + echo "1: TLS1.2 and TLS1.3" + echo "2: TLS1.3 only" + read -p "请输入:" tls_version + [[ -z ${tls_version} ]] && tls_version=1 + if [[ $tls_version == 2 ]];then + sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.3;/' $nginx_conf + echo -e "${OK} ${GreenBG} 已切换至 TLS1.3 only ${Font}" + else + sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.2 TLSv1.3;/' $nginx_conf + echo -e "${OK} ${GreenBG} 已切换至TLS1.2 and TLS1.3 ${Font}" + fi + systemctl restart nginx else - sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.2 TLSv1.3;/' $nginx_conf - echo -e "${OK} ${GreenBG} 已切换至TLS1.2 and TLS1.3 ${Font}" + echo -e "${Error} ${RedBG} Nginx 或 配置文件不存在,请正确安装脚本后执行${Font}" fi } main(){