安装nginx

配置tls1.3

在nginx配置文件内加入

location /路径/
        {
        proxy_redirect off;
        proxy_read_timeout 1200s;
        proxy_pass http://127.0.0.1:11234; #端口
        proxy_http_version 1.1;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
 
 
        # Config for 0-RTT in TLSv1.3
        proxy_set_header Early-Data $ssl_early_data;
 
        }

安装v2ray

bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
#安装历史版本
#bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --version v4.44.0
#启动服务
systemctl enable v2ray

配置v2ray

cd /usr/local/etc/v2ray/
nano config.json

输入以下内容

{
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 11234,  #端口
    "listen":"127.0.0.1",
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "aaaa",  #id
          "level": 1,
          "alterId": 64,
      "email": "akcp1234@gmail.com"
        }
      ]
    },
     "streamSettings": {
      "network": "ws",
      "wsSettings": {
          "path": "/路径/"  #路径
        }
     }
  },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  }
}

重启服务

systemctl restart v2ray.service
systemctl restart nginx.service

如果出现启动错误,可以使用下面的命令查看

/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json
最后修改:2023 年 08 月 28 日
如果觉得我的文章对你有用,请随意赞赏