From fe3f99faf1b90dd3bee0b46e508399574071203b Mon Sep 17 00:00:00 2001 From: wulabing Date: Fri, 6 Apr 2018 18:06:58 +0800 Subject: [PATCH] =?UTF-8?q?V3.3=20=E8=84=9A=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.修复 Ubuntu 16.04/17.10 安装后的Nginx启动失败(等待反馈) 2.修复 由于重复执行脚本导致的 Nginx 安装源的重复添加问题 3.修复 由于重复执行脚本导致的 Nginx 配置文件异常,从而导致Nginx 启动失败的问题 4.修复 Nginx Ubuntu源错误添加问题 --- install.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 59b5c77..68640b3 100644 --- a/install.sh +++ b/install.sh @@ -4,7 +4,7 @@ # System Request:Debian 7+/Ubuntu 14.04+/Centos 6+ # Author: wulabing # Dscription: V2ray ws+tls onekey -# Version: 3.2 +# Version: 3.3 # Blog: https://www.wulabing.com # Official document: www.v2ray.com #==================================================== @@ -56,18 +56,22 @@ EOF echo -e "${OK} ${GreenBG} 当前系统为 Debian ${VERSION_ID} ${VERSION} ${Font} " INS="apt" ## 添加 Nginx apt源 + if [ ! -f nginx_signing.key ];then echo "deb http://nginx.org/packages/mainline/debian/ ${VERSION} nginx" >> /etc/apt/sources.list echo "deb-src http://nginx.org/packages/mainline/debian/ ${VERSION} nginx" >> /etc/apt/sources.list wget -nc https://nginx.org/keys/nginx_signing.key apt-key add nginx_signing.key + fi elif [[ "${ID}" == "ubuntu" && `echo "${VERSION_ID}" | cut -d '.' -f1` -ge 16 ]];then - echo -e "${OK} ${GreenBG} 当前系统为 Ubuntu ${VERSION_ID} ${VERSION} ${Font} " + echo -e "${OK} ${GreenBG} 当前系统为 Ubuntu ${VERSION_ID} ${VERSION_CODENAME} ${Font} " INS="apt" ## 添加 Nginx apt源 - echo "deb http://nginx.org/packages/mainline/debian/ ${VERSION} nginx" >> /etc/apt/sources.list - echo "deb-src http://nginx.org/packages/mainline/debian/ ${VERSION} nginx" >> /etc/apt/sources.list + if [ ! -f nginx_signing.key ];then + echo "deb http://nginx.org/packages/mainline/ubuntu/ ${VERSION_CODENAME} nginx" >> /etc/apt/sources.list + echo "deb-src http://nginx.org/packages/mainline/ubuntu/ ${VERSION_CODENAME} nginx" >> /etc/apt/sources.list wget -nc https://nginx.org/keys/nginx_signing.key apt-key add nginx_signing.key + fi else echo -e "${Error} ${RedBG} 当前系统为 ${ID} ${VERSION_ID} 不在支持的系统列表内,安装中断 ${Font} " exit 1 @@ -154,6 +158,9 @@ modify_port_UUID(){ } modify_nginx(){ ## sed 部分地方 适应新配置修正 + if [[ -f /etc/nginx/nginx.conf.bak ]];then + cp /etc/nginx/nginx.conf.bak /etc/nginx/nginx.conf + fi sed -i "1,/listen/{s/listen 443 ssl;/listen ${port} ssl;/}" ${v2ray_conf} sed -i "/server_name/c \\\tserver_name ${domain};" ${nginx_conf} sed -i "/location/c \\\tlocation \/${camouflage}\/" ${nginx_conf} @@ -194,6 +201,11 @@ nginx_install(){ echo -e "${Error} ${RedBG} nginx 安装失败 ${Font}" exit 5 fi + if [[ ! -f /etc/nginx/nginx.conf.bak ]];then + cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak + echo -e "${OK} ${GreenBG} nginx 初始配置备份完成 ${Font}" + sleep 1 + fi } ssl_install(){ if [[ "${ID}" == "centos" ]];then