自家用潦草笔记,只列大纲,不列过程。

目标: WebSocket+TLS -> nginx -> V2Ray

所需物资:

安装

V2Ray

1
bash <(curl -L -s https://install.direct/go.sh)

Nginx

直接用官方 Packages安装

acme.sh

参照中文文档,4 步搞定:安装 acme.sh -> 生成证书 -> 安装证书 -> 配置自更新

配置

V2Ray

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
"inbounds": [
{
"listen": "127.0.0.1",
"port": 11111, // 监听的端口
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "", // uuid
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/path" // websocket 地址
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

Nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
listen 443 ssl;
ssl_certificate your.cer.path; # 证书 .cer 路径
ssl_certificate_key your.key.path; # 证书 .key 路径
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
server_name yourdomain; # 域名

root your-web-root;

location /yourpath { # websocket 地址
proxy_redirect off;
proxy_pass http://127.0.0.1:your-port; # 监听的端口
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

评论

富强、民主、文明、和谐,自由、平等、公正、法治,爱国、敬业、诚信、友善