Skip to content

Commit 9bcde1a

Browse files
author
brad
committed
add v2ray service
1 parent 7436ce6 commit 9bcde1a

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed

v2ray/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## v2ray 科学上网
2+
3+
官网 https://www.v2fly.org/
4+
5+
github https://github.com/v2fly/v2ray-core
6+
7+
搭建教程 https://toutyrater.github.io/advanced/wss_and_web.html
8+
9+
需要配置 nginx + ssl 可参考 nginx.conf.example 文件
10+
11+
图形客户端
12+
- Windows https://github.com/2dust/v2rayN
13+
- Android https://github.com/2dust/v2rayNG
14+
- macOS https://github.com/yanue/V2rayU
15+

v2ray/conf/config.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"log": {
3+
"loglevel": "warning"
4+
},
5+
"routing": {
6+
"domainStrategy": "AsIs",
7+
"rules": [
8+
{
9+
"type": "field",
10+
"ip": [
11+
"geoip:private"
12+
],
13+
"outboundTag": "block"
14+
}
15+
]
16+
},
17+
"inbounds": [
18+
{
19+
"listen": "0.0.0.0",
20+
"port": 8888,
21+
"protocol": "vmess",
22+
"settings": {
23+
"clients": [
24+
{
25+
"id": "65161e2b-3060-46ad-ab97-7c3ab9f795cf"
26+
}
27+
]
28+
},
29+
"streamSettings": {
30+
"network": "ws",
31+
"security": "none",
32+
"wsSettings": {
33+
"path": "/"
34+
}
35+
}
36+
}
37+
],
38+
"outbounds": [
39+
{
40+
"protocol": "freedom",
41+
"tag": "direct"
42+
},
43+
{
44+
"protocol": "blackhole",
45+
"tag": "block"
46+
}
47+
]
48+
}

v2ray/conf/nginx.conf.example

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
server {
2+
listen 443 ssl;
3+
ssl on;
4+
ssl_certificate /etc/v2ray/v2ray.crt;
5+
ssl_certificate_key /etc/v2ray/v2ray.key;
6+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
7+
ssl_ciphers HIGH:!aNULL:!MD5;
8+
server_name mydomain.me;
9+
location /ray { # 与 V2Ray 配置中的 path 保持一致
10+
proxy_redirect off;
11+
proxy_pass http://127.0.0.1:10000;#假设WebSocket监听在环回地址的10000端口上
12+
proxy_http_version 1.1;
13+
proxy_set_header Upgrade $http_upgrade;
14+
proxy_set_header Connection "upgrade";
15+
proxy_set_header Host $http_host;
16+
17+
# Show realip in v2ray access.log
18+
proxy_set_header X-Real-IP $remote_addr;
19+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
20+
}
21+
}

v2ray/v2ray.service

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[Unit]
2+
Description=v2ray
3+
After=docker.service
4+
Requires=docker.service
5+
6+
[Service]
7+
Restart=always
8+
RestartSec=30
9+
TimeoutStartSec=0
10+
ExecStartPre=-/usr/bin/docker stop v2ray
11+
ExecStartPre=-/usr/bin/docker kill v2ray
12+
ExecStartPre=-/usr/bin/docker rm v2ray
13+
ExecStartPre=-/home/core/docker/shell/install_fleetctl v2ray
14+
ExecStart=/usr/bin/docker run --name v2ray -p 8888:8888 -v /home/core/data/v2ray:/etc/v2ray v2fly/v2fly-core
15+
ExecStop=/usr/bin/docker stop v2ray
16+
ExecStop=/usr/bin/docker kill v2ray
17+
18+
[Install]
19+
WantedBy=multi-user.target
20+
21+
[X-Fleet]
22+
Global=true
23+

0 commit comments

Comments
 (0)