准备

开始

# 创建临时目录
mkdir v2ray
cd v2ray

# 下载程序
wget -O v2ray.zip https://github.com/v2fly/v2ray-core/releases/download/v4.40.0/v2ray-linux-64.zip
unzip v2ray.zip

# 安装程序
mv -f v2* /usr/bin
mv -f *.dat /usr/bin
mv -f config.json /etc/v2ray.json
mv -f systemd/system/v2ray.service /etc/systemd/system
systemctl daemon-reload

配置

v2ray

nano /etc/v2ray.json

{
    "dns": {
        "servers": [
            "1.1.1.1",
            "1.0.0.1"
        ]
    },
    "inbounds": [
        {
            "port": 10000,
            "listen": "127.0.0.1",
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "11f83e97-462f-4f97-9b6f-ea45f692eb84",
                        "alterId": 1
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/"
                }
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {}
        }
    ]
}

nginx

nano /usr/local/nginx/conf/vhost/gentrabbit.moe.conf

location /114514/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Connection $http_connection;
    proxy_set_header Upgrade $http_upgrade;
    proxy_pass http://127.0.0.1:10000/;
}

启动

systemctl restart nginx
systemctl enable --now v2ray

连接