From 644cce7c3679153003ce045ed83b0698d70a2684 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Mon, 28 Dec 2020 13:54:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E6=94=B9De?= =?UTF-8?q?bian8=E5=90=AF=E5=8A=A8nginx=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=81=E4=BF=AE=E6=94=B9Path=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo.sh | 4 ---- documents/shell_error.md | 11 +++++++++++ install.sh | 35 ++++++++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 9 deletions(-) delete mode 100755 demo.sh diff --git a/demo.sh b/demo.sh deleted file mode 100755 index 36b954f..0000000 --- a/demo.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -str="abcdefg" -echo ${str:0-2:4} \ No newline at end of file diff --git a/documents/shell_error.md b/documents/shell_error.md index e51b07a..132c119 100644 --- a/documents/shell_error.md +++ b/documents/shell_error.md @@ -22,3 +22,14 @@ nameserver 8.8.4.4 - 请更换Debian或者Ubuntu,或者拿着vps来私聊作者。 + +## 4.Debian8启动nginx失败 +### 解决方法一 +- 手动删除add_header选项 +``` +vim /etc/nginx/conf.d/alone.conf +# 删除下方代码 +location / { + add_header Strict-Transport-Security "max-age=63072000" always; +} +``` \ No newline at end of file diff --git a/install.sh b/install.sh index 2d4ec8b..c46ac78 100644 --- a/install.sh +++ b/install.sh @@ -12,6 +12,10 @@ checkSystem(){ upgrade="yum update -y --skip-broken" elif [[ ! -z `cat /etc/issue | grep -i "debian" | grep -v grep` ]] || [[ ! -z `cat /proc/version | grep -i "debian" | grep -v grep` ]] then + if [[ ! -z `cat /etc/issue|grep -i "8"` ]] + then + debianVersion=8 + fi release="debian" installType='apt -y install' upgrade="apt update -y" @@ -505,6 +509,7 @@ initTLSNginxConfig(){ # 修改nginx重定向配置 updateRedirectNginxConf(){ + cat << EOF > /etc/nginx/conf.d/alone.conf server { listen 80; @@ -512,17 +517,37 @@ cat << EOF > /etc/nginx/conf.d/alone.conf server_name ${domain}; return 301 https://${domain}$request_uri; } - server { +EOF + + if [[ "${debianVersion}" = "8" ]] + then +cat << EOF >> /etc/nginx/conf.d/alone.conf + server { listen 31300; server_name ${domain}; root /usr/share/nginx/html; - location / { - add_header Strict-Transport-Security "max-age=63072000" always; - } + # location / { + # add_header Strict-Transport-Security "max-age=63072000" always; + # } # location ~ /.well-known {allow all;} # location /test {return 200 'fjkvymb6len';} } EOF + else +cat << EOF >> /etc/nginx/conf.d/alone.conf + server { + listen 31300; + server_name ${domain}; + root /usr/share/nginx/html; + location / { + add_header Strict-Transport-Security "max-age=63072000" always; + } + # location ~ /.well-known {allow all;} + # location /test {return 200 'fjkvymb6len';} + } +EOF + fi + } # 检查ip @@ -3018,7 +3043,7 @@ menu(){ cd echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.2.7" + echoContent green "当前版本:v2.2.8" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:七合一共存脚本" echoContent red "=============================================================="