Merge branch 'master' into reality

dev
mack-a 2023-03-09 15:37:44 +08:00
commit 23f0eac6bb
1 changed files with 54 additions and 29 deletions

View File

@ -194,6 +194,7 @@ initVar() {
btDomain= btDomain=
# nginx配置文件路径 # nginx配置文件路径
nginxConfigPath=/etc/nginx/conf.d/ nginxConfigPath=/etc/nginx/conf.d/
nginxStaticPath=/usr/share/nginx/html/
# 是否为预览版 # 是否为预览版
prereleaseStatus=false prereleaseStatus=false
@ -348,6 +349,11 @@ checkBTPanel() {
ln -s "/www/server/panel/vhost/cert/${btDomain}/privkey.pem" "/etc/v2ray-agent/tls/${btDomain}.key" ln -s "/www/server/panel/vhost/cert/${btDomain}/privkey.pem" "/etc/v2ray-agent/tls/${btDomain}.key"
ln -s "/www/server/panel/vhost/cert/${btDomain}/fullchain.pem" "/etc/v2ray-agent/tls/${btDomain}.crt" ln -s "/www/server/panel/vhost/cert/${btDomain}/fullchain.pem" "/etc/v2ray-agent/tls/${btDomain}.crt"
fi fi
nginxStaticPath="/www/wwwroot/${btDomain}/"
if [[ -f "/www/wwwroot/${btDomain}/.user.ini" ]]; then
chattr -i "/www/wwwroot/${btDomain}/.user.ini"
fi
nginxConfigPath="/www/server/panel/vhost/nginx/" nginxConfigPath="/www/server/panel/vhost/nginx/"
fi fi
fi fi
@ -901,7 +907,7 @@ server {
listen ${port}; listen ${port};
listen [::]:${port}; listen [::]:${port};
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root ${nginxStaticPath};
location ~ /.well-known { location ~ /.well-known {
allow all; allow all;
} }
@ -952,7 +958,7 @@ EOF
server { server {
listen 127.0.0.1:31302 http2 so_keepalive=on; listen 127.0.0.1:31302 http2 so_keepalive=on;
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root ${nginxStaticPath};
client_header_timeout 1071906480m; client_header_timeout 1071906480m;
keepalive_timeout 1071906480m; keepalive_timeout 1071906480m;
@ -993,7 +999,7 @@ EOF
server { server {
listen 127.0.0.1:31302 http2; listen 127.0.0.1:31302 http2;
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
@ -1018,7 +1024,7 @@ EOF
server { server {
listen 127.0.0.1:31302 http2; listen 127.0.0.1:31302 http2;
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
@ -1042,7 +1048,7 @@ EOF
server { server {
listen 127.0.0.1:31302 http2; listen 127.0.0.1:31302 http2;
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
@ -1057,7 +1063,7 @@ EOF
server { server {
listen 127.0.0.1:31300; listen 127.0.0.1:31300;
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
@ -1270,7 +1276,7 @@ customPortFunction() {
if [[ -z "${currentPort}" && -z "${customPort}" ]] || [[ "${historyCustomPortStatus}" == "n" ]]; then if [[ -z "${currentPort}" && -z "${customPort}" ]] || [[ "${historyCustomPortStatus}" == "n" ]]; then
echo echo
if [[ -n "${btnDomain}" ]]; then if [[ -n "${btDomain}" ]]; then
echoContent yellow "请输入端口[不可于BT Panel端口相同]" echoContent yellow "请输入端口[不可于BT Panel端口相同]"
else else
echoContent yellow "请输入端口[默认: 443]如自定义端口只允许使用DNS申请证书[回车使用默认]" echoContent yellow "请输入端口[默认: 443]如自定义端口只允许使用DNS申请证书[回车使用默认]"
@ -1387,7 +1393,7 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root ${nginxStaticPath};
location ~ /.well-known {allow all;} location ~ /.well-known {allow all;}
location /test {return 200 'fjkvymb6len';} location /test {return 200 'fjkvymb6len';}
} }
@ -1439,23 +1445,23 @@ randomPathFunction() {
# Nginx伪装博客 # Nginx伪装博客
nginxBlog() { nginxBlog() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 添加伪装站点" echoContent skyBlue "\n进度 $1/${totalProgress} : 添加伪装站点"
if [[ -d "/usr/share/nginx/html" && -f "/usr/share/nginx/html/check" ]]; then if [[ -d "${nginxStaticPath}" && -f "${nginxStaticPath}/check" ]]; then
echo echo
read -r -p "检测到安装伪装站点,是否需要重新安装[y/n]:" nginxBlogInstallStatus read -r -p "检测到安装伪装站点,是否需要重新安装[y/n]:" nginxBlogInstallStatus
if [[ "${nginxBlogInstallStatus}" == "y" ]]; then if [[ "${nginxBlogInstallStatus}" == "y" ]]; then
rm -rf /usr/share/nginx/html rm -rf "${nginxStaticPath}"
randomNum=$((RANDOM % 6 + 1)) randomNum=$((RANDOM % 6 + 1))
wget -q -P /usr/share/nginx https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null wget -q -P "${nginxStaticPath}" https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null
unzip -o /usr/share/nginx/html${randomNum}.zip -d /usr/share/nginx/html >/dev/null unzip -o "${nginxStaticPath}html${randomNum}.zip" -d "${nginxStaticPath}" >/dev/null
rm -f /usr/share/nginx/html${randomNum}.zip* rm -f "${nginxStaticPath}html${randomNum}.zip*"
echoContent green " ---> 添加伪装站点成功" echoContent green " ---> 添加伪装站点成功"
fi fi
else else
randomNum=$((RANDOM % 6 + 1)) randomNum=$((RANDOM % 6 + 1))
rm -rf /usr/share/nginx/html rm -rf "${nginxStaticPath}"
wget -q -P /usr/share/nginx https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null wget -q -P "${nginxStaticPath}" https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null
unzip -o /usr/share/nginx/html${randomNum}.zip -d /usr/share/nginx/html >/dev/null unzip -o "${nginxStaticPath}html${randomNum}.zip" -d "${nginxStaticPath}" >/dev/null
rm -f /usr/share/nginx/html${randomNum}.zip* rm -f "${nginxStaticPath}html${randomNum}.zip*"
echoContent green " ---> 添加伪装站点成功" echoContent green " ---> 添加伪装站点成功"
fi fi
@ -3553,7 +3559,7 @@ addNginx302() {
updateNginxBlog() { updateNginxBlog() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 更换伪装站点" echoContent skyBlue "\n进度 $1/${totalProgress} : 更换伪装站点"
echoContent red "==============================================================" echoContent red "=============================================================="
echoContent yellow "# 如需自定义,请手动复制模版文件到 /usr/share/nginx/html \n" echoContent yellow "# 如需自定义,请手动复制模版文件到 ${nginxStaticPath} \n"
echoContent yellow "1.新手引导" echoContent yellow "1.新手引导"
echoContent yellow "2.游戏网站" echoContent yellow "2.游戏网站"
echoContent yellow "3.个人博客01" echoContent yellow "3.个人博客01"
@ -3605,8 +3611,8 @@ updateNginxBlog() {
wget -c -P /usr/share/nginx "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${selectInstallNginxBlogType}.zip" >/dev/null wget -c -P /usr/share/nginx "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${selectInstallNginxBlogType}.zip" >/dev/null
fi fi
unzip -o "/usr/share/nginx/html${selectInstallNginxBlogType}.zip" -d /usr/share/nginx/html >/dev/null unzip -o "${nginxStaticPath}${selectInstallNginxBlogType}.zip" -d "${nginxStaticPath}" >/dev/null
rm -f "/usr/share/nginx/html${selectInstallNginxBlogType}.zip*" rm -f "${nginxStaticPath}${selectInstallNginxBlogType}.zip*"
echoContent green " ---> 更换伪站成功" echoContent green " ---> 更换伪站成功"
else else
echoContent red " ---> 选择错误,请重新选择" echoContent red " ---> 选择错误,请重新选择"
@ -3786,8 +3792,8 @@ unInstall() {
rm -rf /etc/v2ray-agent rm -rf /etc/v2ray-agent
rm -rf ${nginxConfigPath}alone.conf rm -rf ${nginxConfigPath}alone.conf
if [[ -d "/usr/share/nginx/html" && -f "/usr/share/nginx/html/check" ]]; then if [[ -d "${nginxStaticPath}" && -f "${nginxStaticPath}/check" ]]; then
rm -rf /usr/share/nginx/html rm -rf "${nginxStaticPath}"
echoContent green " ---> 删除伪装网站完成" echoContent green " ---> 删除伪装网站完成"
fi fi
@ -5246,7 +5252,18 @@ customXrayInstall() {
randomPathFunction 4 randomPathFunction 4
customCDNIP 5 customCDNIP 5
fi fi
if [[ -n "${btDomain}" ]]; then
echoContent skyBlue "\n进度 6/${totalProgress} : 检测到宝塔面板,是否 安装/重新安装 伪装站点?"
echoContent red "=============================================================="
echoContent yellow "# 注意事项"
echoContent yellow "会清空当前安装网站下面的静态目录,如已自定义安装过请选择 [n]\n"
read -r -p "请选择[y/n]:" nginxBlogBTStatus
if [[ "${nginxBlogBTStatus}" == "y" ]]; then
nginxBlog 6 nginxBlog 6
fi
else
nginxBlog 6
fi
updateRedirectNginxConf updateRedirectNginxConf
handleNginx start handleNginx start
@ -5352,17 +5369,13 @@ xrayCoreInstall() {
echoContent skyBlue "\n进度 3/${totalProgress} : 检测到宝塔面板跳过申请TLS步骤" echoContent skyBlue "\n进度 3/${totalProgress} : 检测到宝塔面板跳过申请TLS步骤"
handleXray stop handleXray stop
customPortFunction customPortFunction
else else
# 申请tls # 申请tls
initTLSNginxConfig 3 initTLSNginxConfig 3
handleXray stop handleXray stop
handleNginx start handleNginx start
checkIP checkIP
installTLS 4 installTLS 4
fi fi
handleNginx stop handleNginx stop
@ -5375,7 +5388,19 @@ xrayCoreInstall() {
initXrayConfig all 9 initXrayConfig all 9
cleanUp v2rayDel cleanUp v2rayDel
installCronTLS 10 installCronTLS 10
if [[ -n "${btDomain}" ]]; then
echoContent skyBlue "\n进度 11/${totalProgress} : 检测到宝塔面板,是否 安装/重新安装 伪装站点?"
echoContent red "=============================================================="
echoContent yellow "# 注意事项"
echoContent yellow "会清空当前安装网站下面的静态目录,如已自定义安装过请选择 [n]\n"
read -r -p "请选择[y/n]:" nginxBlogBTStatus
if [[ "${nginxBlogBTStatus}" == "y" ]]; then
nginxBlog 11 nginxBlog 11
fi
else
nginxBlog 11
fi
updateRedirectNginxConf updateRedirectNginxConf
handleXray stop handleXray stop
sleep 2 sleep 2
@ -5685,7 +5710,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.7.10" echoContent green "当前版本v2.7.11"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus