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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
| #!/bin/bash
# 安装和更新v2ray
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
# 安裝最新发行的 geoip.dat 和 geosite.dat
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)
# 开机启动v2ray
systemctl enable v2ray
# 启动v2ray
systemctl start v2ray
# 查看v2ray状态
systemctl status v2ray
# 下载证书
mkdir /etc/v2ray
wget "https://www.dynadot.com/letsencrypt/download_cert?key=n6b8F6X7Zg6T9W6l8R8jYl7w8z6qM83Kr6o7c6tL&domain=wnbzgdzpf.top" -O /etc/v2ray/v2ray.cert
wget "https://picazza-test.oss-cn-beijing.aliyuncs.com/self_built_v2ray/ssl/wnbzgdzpf.top.key" -O /etc/v2ray/v2ray.key
cat > /usr/local/etc/v2ray/config.json <<EOF
{
"log": {
"loglevel": "warning",
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log"
},
"inbounds": [
{
"tag": "trojan-in",
"port": 1996,
"protocol": "trojan",
"listen": "0.0.0.0",
"settings": {
"clients": [
{
"password": "a4100ea3-d5bc-4dd6-b02a-a55321fb0bcc",
"flow": "xtls-rprx-vision",
"email": "trojan-user@example.com"
}
],
"fallbacks": []
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "newjersey.wnbzgdzpf.top",
"alpn": [
"http/1.1"
],
"certificates": [
{
"certificateFile": "/etc/v2ray/v2ray.cert",
"keyFile": "/etc/v2ray/v2ray.key"
}
]
}
}
},
{
"tag": "vless-in",
"port": 1998,
"protocol": "vless",
"listen": "0.0.0.0",
"settings": {
"clients": [
{
"id": "a4100ea3-d5bc-4dd6-b02a-a55321fb0bcc",
"flow": "xtls-rprx-vision",
"email": "vless-user@example.com",
"level": 0
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "newjersey.wnbzgdzpf.top",
"alpn": [
"http/1.1"
],
"certificates": [
{
"certificateFile": "/etc/v2ray/v2ray.cert",
"keyFile": "/etc/v2ray/v2ray.key"
}
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "freedom"
}
]
}
}
EOF
# 防火墙放行端口
sudo ufw allow 1996/tcp
sudo ufw allow 1998/tcp
# 重启服务
sudo systemctl daemon-reload
sudo systemctl restart v2ray
sudo systemctl status v2ray
|