From 0607f1f764b345ab1d89453cf877ce847d58cfa5 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:34:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20=E5=A2=9E=E5=8A=A0x?= =?UTF-8?q?ray-core=E5=9B=9E=E8=90=BD=E5=88=B0nginx=E7=9A=84=E7=9C=9F?= =?UTF-8?q?=E5=AE=9EIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- documents/install_tls.md | 13 ------------ install.sh | 44 +++++++++++++++++++++++++++++----------- 3 files changed, 33 insertions(+), 27 deletions(-) delete mode 100644 documents/install_tls.md diff --git a/README.md b/README.md index 31275d9..4a18ae0 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ - [垃圾VPS大救星,hysteria2最新协议一键搭建](https://www.v2ray-agent.com/archives/1697162969693) - [Tuic V5性能提升及使用方法](https://www.v2ray-agent.com/archives/1687167522196) - [Cloudflare优选IP、自动选择最快节点教程](https://www.v2ray-agent.com/archives/1684858575649) +- [脚本使用注意事项](https://www.v2ray-agent.com/archives/1679931532764) - [脚本异常处理](https://www.v2ray-agent.com/archives/1684115970026) # 三、线路推荐 @@ -87,8 +88,6 @@ wget -P /root -N --no-check-certificate "https://www.v2ray-agent.com/v2ray-agent ## 2.使用 -- [2.脚本快速搭建教程](https://www.v2ray-agent.com/archives/1682491479771) - # 四、反馈和建议 - 提交[issue](https://github.com/mack-a/v2ray-agent/issues)、[加入](https://t.me/technologyshare)群聊 diff --git a/documents/install_tls.md b/documents/install_tls.md deleted file mode 100644 index 7222858..0000000 --- a/documents/install_tls.md +++ /dev/null @@ -1,13 +0,0 @@ -# 使用现有的证书进行脚本安装 -## 1.创建目录 -``` -mkdir -p /etc/v2ray-agent/tls -``` -## 2.将证书放到指定目录并修改名称 ->下方的domain为要安装的域名 -- 1.移动证书和私钥到/etc/v2ray-agent/tls下 -- 2.修改文件名称 -``` -xxx.key --> domain.key -xxx.crt or xxx.pem or xxx.cer --> domain.crt -``` \ No newline at end of file diff --git a/install.sh b/install.sh index 7bdee04..80d5d4c 100644 --- a/install.sh +++ b/install.sh @@ -1292,11 +1292,11 @@ updateRedirectNginxConf() { redirectDomain=${domain}:${port} local nginxH2Conf= - nginxH2Conf="listen 127.0.0.1:31302 http2 so_keepalive=on;" + nginxH2Conf="listen 127.0.0.1:31302 http2 so_keepalive=on proxy_protocol;" nginxVersion=$(nginx -v 2>&1) if echo "${nginxVersion}" | grep -q "1.25" && [[ $(echo "${nginxVersion}" | awk -F "[.]" '{print $3}') -gt 0 ]]; then - nginxH2Conf="listen 127.0.0.1:31302 so_keepalive=on;http2 on;" + nginxH2Conf="listen 127.0.0.1:31302 so_keepalive=on proxy_protocol;http2 on;" fi cat <${nginxConfigPath}alone.conf @@ -1315,10 +1315,14 @@ server { server_name ${domain}; root ${nginxStaticPath}; + set_real_ip_from 0.0.0.0/0; + real_ip_header proxy_protocol; + client_header_timeout 1071906480m; keepalive_timeout 1071906480m; location ~ ^/s/(clashMeta|default|clashMetaProfiles)/(.*) { + proxy_set_header X-Real-IP \$proxy_protocol_addr; default_type 'text/plain; charset=utf-8'; alias /etc/v2ray-agent/subscribe/\$1/\$2; } @@ -1352,9 +1356,14 @@ EOF cat <>${nginxConfigPath}alone.conf server { ${nginxH2Conf} + + set_real_ip_from 0.0.0.0/0; + real_ip_header proxy_protocol; + server_name ${domain}; root ${nginxStaticPath}; location ~ ^/s/(clashMeta|default|clashMetaProfiles)/(.*) { + proxy_set_header X-Real-IP \$proxy_protocol_addr; default_type 'text/plain; charset=utf-8'; alias /etc/v2ray-agent/subscribe/\$1/\$2; } @@ -1375,9 +1384,14 @@ EOF cat <>${nginxConfigPath}alone.conf server { ${nginxH2Conf} - server_name ${domain}; + + set_real_ip_from 0.0.0.0/0; + real_ip_header proxy_protocol; + + server_name ${domain}; root ${nginxStaticPath}; location ~ ^/s/(clashMeta|default|clashMetaProfiles)/(.*) { + proxy_set_header X-Real-IP \$proxy_protocol_addr; default_type 'text/plain; charset=utf-8'; alias /etc/v2ray-agent/subscribe/\$1/\$2; } @@ -1399,13 +1413,18 @@ EOF cat <>${nginxConfigPath}alone.conf server { ${nginxH2Conf} + + set_real_ip_from 0.0.0.0/0; + real_ip_header proxy_protocol; + server_name ${domain}; root ${nginxStaticPath}; location ~ ^/s/(clashMeta|default|clashMetaProfiles)/(.*) { - default_type 'text/plain; charset=utf-8'; - alias /etc/v2ray-agent/subscribe/\$1/\$2; - } + proxy_set_header X-Real-IP \$proxy_protocol_addr; + default_type 'text/plain; charset=utf-8'; + alias /etc/v2ray-agent/subscribe/\$1/\$2; + } location / { } } @@ -1418,9 +1437,10 @@ server { server_name ${domain}; root ${nginxStaticPath}; location ~ ^/s/(clashMeta|default|clashMetaProfiles)/(.*) { - default_type 'text/plain; charset=utf-8'; - alias /etc/v2ray-agent/subscribe/\$1/\$2; - } + proxy_set_header X-Real-IP \$proxy_protocol_addr; + default_type 'text/plain; charset=utf-8'; + alias /etc/v2ray-agent/subscribe/\$1/\$2; + } location / { } } @@ -3798,11 +3818,11 @@ EOF EOF # VLESS_TCP_TLS_Vision # 回落nginx - local fallbacksList='{"dest":31300,"xver":0},{"alpn":"h2","dest":31302,"xver":0}' + local fallbacksList='{"dest":31300,"xver":1},{"alpn":"h2","dest":31302,"xver":1}' # trojan if echo "${selectCustomInstallType}" | grep -q ",4," || [[ "$1" == "all" ]]; then - fallbacksList='{"dest":31296,"xver":1},{"alpn":"h2","dest":31302,"xver":0}' + fallbacksList='{"dest":31296,"xver":1},{"alpn":"h2","dest":31302,"xver":1}' cat </etc/v2ray-agent/xray/conf/04_trojan_TCP_inbounds.json { "inbounds":[ @@ -8716,7 +8736,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v3.2.6" + echoContent green "当前版本:v3.2.7" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus