Skip to content

Commit

Permalink
feat(脚本): 增加xray-core回落到nginx的真实IP
Browse files Browse the repository at this point in the history
  • Loading branch information
mack-a committed Feb 4, 2024
1 parent 4aa6da8 commit 0607f1f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

# 三、线路推荐
Expand Down Expand Up @@ -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)群聊
Expand Down
13 changes: 0 additions & 13 deletions documents/install_tls.md

This file was deleted.

44 changes: 32 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF >${nginxConfigPath}alone.conf
Expand All @@ -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;
}
Expand Down Expand Up @@ -1352,9 +1356,14 @@ EOF
cat <<EOF >>${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;
}
Expand All @@ -1375,9 +1384,14 @@ EOF
cat <<EOF >>${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;
}
Expand All @@ -1399,13 +1413,18 @@ EOF
cat <<EOF >>${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 / {
}
}
Expand All @@ -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 / {
}
}
Expand Down Expand Up @@ -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 <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_TCP_inbounds.json
{
"inbounds":[
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0607f1f

Please sign in to comment.