V2Ray 是一个用于代理网络访问的工具,常用于防止监控、防止访问限制等场景。它的配置文件主要包含代理规则和设置,以下是一些常见的 V2Ray 配置示例和配置文件内容
基本配置文件 最简单的 V2Ray 配置文件如下: v2ray: proxy: IN: - 127...1:80 OUT: - 127...1:80 listener: tcp4 解释: IN:输入接口,例如本地监听某个端口。 OUT:输出接口,例如将流量转发到目标地址。 listener:指定监听类型,tcp4 表示 TCP 协议的 IPv4 接口。 高级配置文件 以下是一个更复杂的配置文件,适用于更高级的代理需求: v2ray: proxy: IN: - 127...1:80 OUT: - 127...1:80 listener: tcp4 settings: - domain: 127...1 port: 80 user: admin pass: password dns: servers: - 127...1 port: 53 proxy-dns: enabled: true servers: - 127...1 port: 53 http-filter: enabled: true rules: - domain: example.com match: http replace: http://127...1:80 - domain: google.com match: https replace: https://127...1:80 outbound: modified: - destination: google.com replace: x.google.com 解释: settings:代理设置,包括域名、端口、用户和密码。 dns:配置 DNS 服务器,proxy-dns 表示代理 DNS 查询。 http-f...
基本配置文件
最简单的 V2Ray 配置文件如下:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
- 解释:
IN:输入接口,例如本地监听某个端口。OUT:输出接口,例如将流量转发到目标地址。listener:指定监听类型,tcp4表示 TCP 协议的 IPv4 接口。
高级配置文件
以下是一个更复杂的配置文件,适用于更高级的代理需求:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
settings:
- domain: 127...1
port: 80
user: admin
pass: password
dns:
servers:
- 127...1
port: 53
proxy-dns:
enabled: true
servers:
- 127...1
port: 53
http-filter:
enabled: true
rules:
- domain: example.com
match: http
replace: http://127...1:80
- domain: google.com
match: https
replace: https://127...1:80
outbound:
modified:
- destination: google.com
replace: x.google.com
- 解释:
settings:代理设置,包括域名、端口、用户和密码。dns:配置 DNS 服务器,proxy-dns表示代理 DNS 查询。http-filter:HTTP过滤规则,用于重定向或修改请求。outbound:处理输出流量的规则,例如修改域名。
过滤域名和网站
以下是一个用于过滤域名和网站的配置文件:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
settings:
- domain: 127...1
port: 80
user: admin
pass: password
filter:
domain-list:
- example.com
- google.com
ip-list:
- 10.../24
port-list:
- 80
- 443
http-filter:
enabled: true
dns-filter:
enabled: true
outbound:
modified:
- destination: example.com
replace: x.example.com
- 解释:
filter:过滤规则,包括域名、IP地址、端口等。domain-list:过滤的域名列表。ip-list:过滤的 IP 地址范围。port-list:过滤的端口列表。http-filter:启用 HTTP 过滤。dns-filter:启用 DNS 过滤。
高级代理配置
以下是一个更复杂的配置文件,适用于多个代理需求:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
settings:
- domain: 127...1
port: 80
user: admin
pass: password
dns:
servers:
- 127...1
port: 53
proxy-dns:
enabled: true
servers:
- 127...1
port: 53
http-filter:
enabled: true
rules:
- domain: example.com
match: http
replace: http://127...1:80
- domain: google.com
match: https
replace: https://127...1:80
outbound:
modified:
- destination: google.com
replace: x.google.com
domain-spoofing:
- domain: example.com
replace: x.example.com
ip-filter:
enabled: true
ip-list:
- 10.../24
port-filter:
enabled: true
port-list:
- 80
- 443
limit:
bandwidth: 1M
delay: 100ms
- 解释:
outbound:处理输出流量的规则,包括域名重定向和 IP spoofing。ip-filter:限制特定的 IP-range。port-filter:限制特定的端口。limit:限制带宽和延迟。
过滤特定网站
以下是一个用于过滤特定网站的配置文件:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
settings:
- domain: 127...1
port: 80
user: admin
pass: password
http-filter:
enabled: true
rules:
- domain: google.com
match: all
replace: http://127...1:80
- domain: youtube.com
match: https
replace: https://127...1:80
outbound:
modified:
- destination: google.com
replace: x.google.com
- 解释:
http-filter:过滤 HTTP 和 HTTPS 流量。rules:指定需要重定向的域名和请求类型。
使用 Dokku 或 Cloudflare
以下是一个用于 Dokku 或 Cloudflare 的配置文件:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
settings:
- domain: 127...1
port: 80
user: admin
pass: password
outbound:
modified:
- destination: dokku.example.com
replace: x.dokku.example.com
- 解释:
这个配置文件适用于在 Dokku 或 Cloudflare 上运行的 V2Ray,用于重定向特定域名的流量。
使用 Cloudflare Worker
以下是一个用于 Cloudflare Worker 的配置文件:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
settings:
- domain: 127...1
port: 80
user: admin
pass: password
outbound:
modified:
- destination: example.com
replace: x.example.com
- 解释:
这个配置文件用于在 Cloudflare Worker 上运行的 V2Ray,用于重定向特定域名的流量。
使用 Xray 验证
以下是一个用于验证 Xray 统治的配置文件:
v2ray:
proxy:
IN:
- 127...1:80
OUT:
- 127...1:80
listener: tcp4
settings:
- domain: 127...1
port: 80
user: admin
pass: password
outbound:
modified:
- destination: xray.example.com
replace: xray.example.com
- 解释:
这个配置文件用于验证 Xray 统治是否正常工作。
注意事项
- 修改配置文件:请根据你的实际需求修改配置文件中的域名、端口、IP地址等信息。
- hosts 文件:如果需要

相关文章







