# 富强

既然有了一台 Oracle Cloud 云服务器,那就考虑替换下月付费的科学上网
在网上翻找了好多资料,决定是 v2ray
核心就是基于 nginx 搭建 v2ray 服务器,服务端配置 vmess+tls+websocket

# 民主

搭建 v2ray 的步骤大体如下:

# 文明

安装 v2ray

命令行提示符
curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh

# 和谐

编辑 v2ray 配置文件
其中,port、clients [i].id、wsSettings.path 需要自行更换为自己想设定的值

命令行提示符
vi /usr/local/etc/v2ray/config.json
{
    "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "info"
    },
    "inbounds": [{
            "port": 11055,
            "protocol": "vmess",
            "settings": {
                "clients": [{
                        "id": "27848739-7e62-4138-9fd3-098a63964b6b",
                        "level": 1,
                        "alterId": 0
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/tech"
                }
            }
        }
    ],
    "outbounds": [{
            "protocol": "freedom"
        }
    ]
}

service v2ray restart
查看详细日志:journalctl -xe
access.log/error.log 没有权限,chmod 777

# 法制

启动 v2ray

命令行提示符
systemctl start v2ray
systemctl enable v2ray

# 自由

配置 nginx

# v2ray
# 11055对应v2ray/config.json里的inbounds端口port
# /tech对应v2ray/config.json里streamStttings的wsSettings.path
location /tech {
  proxy_redirect off;
  proxy_pass http://127.0.0.1:11055;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_set_header Host $http_host;
}

最后重启 nginx

# 平等

使用方式

# 手机使用的是 Shhadowrocket

  1. 创建节点,选择类型 Vmess
  2. 地址配置为自己的域名
  3. 端口是 ssl - 443
  4. uuid 配置为 clients [i].id
  5. 额外 ID 为 0
  6. 算法 auto
  7. TLS - 开
  8. 传输方式选择 websocket

# PC 使用的是 ClashX

跟手机配置项都差不多,修改的是 proxies 里的配置

  1. type: vmess
  2. server: 自己的域名
  3. port: 443
  4. uuid: clients[i].id
  5. alterId: 0
  6. cipher: auto
  7. network: ws
  8. tls: true
  9. ws-path: wsSettings.path