fix(脚本): 修改Debian8启动nginx报错问题、修改Path展示不全问题

pull/534/merge
mack-a 2020-12-28 13:54:38 +08:00
parent 6aeacf7e56
commit 644cce7c36
3 changed files with 41 additions and 9 deletions

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
str="abcdefg"
echo ${str:0-2:4}

View File

@ -22,3 +22,14 @@ nameserver 8.8.4.4
- 请更换Debian或者Ubuntu或者拿着vps来私聊作者。
<img src="https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/install/shell_error_02.jpg" width=700>
## 4.Debian8启动nginx失败
### 解决方法一
- 手动删除add_header选项
```
vim /etc/nginx/conf.d/alone.conf
# 删除下方代码
location / {
add_header Strict-Transport-Security "max-age=63072000" always;
}
```

View File

@ -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 "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:七合一共存脚本"
echoContent red "=============================================================="