声明,本人采用Debian发行版Linux系统

1.下载v2ray

# wget v2ray
wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh

2.修改默认配置路径,也可以不修改

# setting config path
修改install-release.sh文件中路径 JSON_PATH=${JSON_PATH:-/usr/local/etc/v2ray}
修改成 JSON_PATH=${JSON_PATH:-/etc/v2ray}

3.安装v2ray

# install v2ray
bash install-release.sh

4.下载安装 geoip.dat && geosite.dat

# install geoip.dat && geosite.dat
wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh 
bash install-dat-release.sh

5.编辑修改v2ray配置 /usr/local/etc/v2ray/config.json

{
  "inbounds": [
    {
      "port": 10086,  //可以修改成你需要的端口
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "2fb8d53d-1e1e-4072-9277-e78a3c83cc19",   //你可以自己生存,修改成你需要的
            "level": 1,
            "alterId": 16
          }
        ]
      },
      "tag": "in-0",
      "streamSettings": {
        "network": "ws",
        "security": "none",
        "wsSettings": {
          "path": "/path"   //修改成你默认网站的路径
        }
      },
      "listen": "127.0.0.1"
    }
  ],
  "outbounds": [
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "ip": [ "geoip:private" ],
        "outboundTag": "blocked"
      }
    ]
  },
  "policy": {},
  "reverse": {},
  "transport": {}
}

7. 配置v2ray开机启动和启动

systemctl start v2ray.service
systemctl enable v2ray.service

8 需要在网站配置中增加反向代理

    location /path {
        proxy_redirect off;
        proxy_pass http://127.0.0.1:10086;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_read_timeout 300s;
    }

作者 uoscn