最新版 v2ray+nginx+wss+tls+cf+dns CentOS

mowen 2021-07-02 99

1、安裝和更新 V2Ray

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)


2、安裝和更新 geoip.dat 和 geosite.dat

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)


3、编辑配置文件

vim /usr/local/etc/v2ray/config.json
{
    "log":{
        "loglevel":"warning",
        "access":"/var/log/v2ray/access.log",
        "error":"/var/log/v2ray/error.log"
    },
    "inbounds":[
        {
            "port":9999,
            "protocol":"vmess",
            "settings":{
                "clients":[
                    {
                        "id":"e7358c59-ba27-4151-bcb3-a01ab7d96029",
                        "level":1,
                        "alterId":64
                    }
                ]
            },
            "streamSettings":{
                "network":"ws",
                "wsSettings":{
                    "path":"/pass"
                }
            },
            "listen":"127.0.0.1"
        }
    ],
    "outbounds":[
        {
            "protocol":"freedom"
        },
        {
            "protocol":"blackhole",
            "settings":{
            },
            "tag":"blocked"
        }
    ],
    "routing":{
        "rules":[
            {
                "type":"field",
                "ip":[
                    "geoip:private"
                ],
                "outboundTag":"blocked"
            }
        ]
    }
}


4、启动服务

systemctl restart v2ray


5、Nginx设置

    location /pass { # 与 V2Ray 配置中的 path 保持一致
      proxy_redirect off;
      proxy_pass http://127.0.0.1:9999; # v2ray监听地址
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header Host $host;
      # Show real IP in v2ray access.log
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }


6、Cf设置

1) 开启dns only
2) rules -> xxx/pass -> cache level -> ByPass
3) ssl/tls -> full


7、客户端

Windows     v2rayN-Core     官网下载 

Android       v2rayNG            官网下载 

iOS               Shadowrocket   AppStore


8、v2rayN设置(红色区域和Nginx设置保持一致蓝色区域和v2ray服务器保持一致紫色区域为固定wss协议和端口




最新回复 (0)
返回
发新帖
X