feat(脚本): 增加xray-core回落到nginx的真实IP

pull/965/head
mack-a 2024-02-04 17:34:41 +08:00
parent 4aa6da87fe
commit 0607f1f764
3 changed files with 33 additions and 27 deletions

View File

@ -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)群聊

View File

@ -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
```

View File

@ -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
@ -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 <<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;
}
@ -1375,9 +1384,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;
}
@ -1399,10 +1413,15 @@ 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;
}
@ -1418,6 +1437,7 @@ server {
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;
}
@ -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":[
@ -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 "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus