# v2ray 搭建教程 **Published by:** [晨辰bk](https://paragraph.com/@bk-5/) **Published on:** 2021-12-27 **URL:** https://paragraph.com/@bk-5/v2ray ## Content 购买服务器并连接省略不写,不会的自行百度image.pngUCloud全球大促:https://www.ucloud.cn/site/active/kuaijiesale.html?invitation_code=C1x2E6088EA03C6 CDN超值特惠专场:https://www.ucloud.cn/site/active/cdn-ufile.html?invitation_code=C1x2E6088EA03C6 快杰云主机推广:https://www.ucloud.cn/site/active/ohost.html?invitation_code=C1x2E6088EA03C6安装安装wgetsudo yum -y install wget 安装unzipsudo yum install zip unzip 安装v2raybash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) 等待安装完成项目地址 https://github.com/v2fly/v2ray-core安装和更新文档 https://github.com/v2fly/fhs-install-v2ray参考网站 https://www.v2ray.com/生成UUIDcat /proc/sys/kernel/random/uuid 记住生成的这玩意b72dc422-5813-4a98-98fc-e14c3e9904d8配置进入config.json/usr/local/etc/v2ray/config.json 配置如下{ "inbounds": [{ "port": 20001, "protocol": "vmess", "settings": { "clients": [ { "id": "b72dc422-5813-4a98-98fc-e14c3e9904d8", "level": 1, "alterId": 64 } ] } }], "outbounds": [{ "protocol": "freedom", "settings": {} },{ "protocol": "blackhole", "settings": {}, "tag": "blocked" }], "routing": { "rules": [ { "type": "field", "ip": ["geoip:private"], "outboundTag": "blocked" } ] } } 直接复制我上面的配置即可使用,id就是上面第二步获取的用户id此时端口是20001ID是b72dc422-5813-4a98-98fc-e14c3e9904d8启动在首次安装完成之后,V2Ray 不会自动启动,需要手动运行上述启动命令## 启动 sudo systemctl start v2ray ## 停止 sudo systemctl stop v2ray ## 重启 sudo systemctl restart v2ray 客户端使用windows【v2rayN-v2rayN.exe-Github Release】 https://github.com/2dust/v2rayN/releases【v2ray-windows-64.zip Github Release】 https://github.com/v2ray/v2ray-core/releasesAndroid需要你去网上找设备相应的CPU架构并进行选择下载,也可以选择“universal”通用版的,但它却要比其它的安装包大个两倍多,难免会有些臃肿)https://github.com/2dust/v2rayNG/releasesmacos(Debian、Ubantu、CentOS等电脑桌面发行版(不能完全通用,可以尝试一下))https://github.com/jiangxufeng/v2rayL/releasesios需要国外账号,推荐shadowrocket(小火箭),quantumult(圈),kitsunebi工具列表图形客户端V2RayWV2RayW 是一个基于 V2Ray 内核的 Windows 客户端。用户可以通过界面生成配置文件,并且可以手动更新 V2Ray 内核。下载:GitHubV2RayNV2RayN 是一个基于 V2Ray 内核的 Windows 客户端。下载:GitHubClash for Windows下载:GitHubV2RayXV2RayX 是一个基于 V2Ray 内核的 Mac OS X 客户端。用户可以通过界面生成配置文件,并且可以手动更新 V2Ray 内核。V2RayX 还可以配置系统代理。下载:GithubV2RayUV2rayU,基于v2ray核心的mac版客户端,界面友好,使用swift4.2编写,支持vmess,shadowsocks,socks5等服务协议,支持订阅, 支持二维码,剪贴板导入,手动配置,二维码分享等。下载:GitHubV2RayC下载:GitHubClashX下载:GitHubQv2rayQv2ray:使用 Qt 编写的 v2ray 跨平台 GUI (MacOS, Windows, Linux)支持连接导入和编辑,中英文切换下载:GitHub官网:https://lhy0403.github.io/Qv2rayMellowMellow 是一个基于规则的全局透明代理工具,可以运行在 Windows、macOS 和 Linux 上,也可以配置成路由器透明代理或代理网关,支持 SOCKS、HTTP、Shadowsocks、VMess 等多种代理协议。Download: GithubKitsunebiKitsunebi 是一个基于 V2Ray 核心的移动平台应用 (iOS, Android)。它可以创建基于 VMess 或者 Shadowsocks 的 VPN 连接。Kitsunebi 支持导入和导出与 V2Ray 兼容的 JSON 配置。由于使用 V2Ray 核心,Kitsunebi 几乎支持 V2Ray 的所有功能,比如 Mux 和 mKCP。下载:iTunes | Play Storei2Rayi2Ray 是另一款基于 V2Ray 核心的iOS应用。界面简洁易用,适合新手用户使用。同时兼容Shadowrocket和Quantumult格式的规则导入。下载:iTunesShadowrocketShadowrocket 是一个通用的 iOS VPN 应用,它支持众多协议,如 Shadowsocks、VMess、SSR 等。下载:iTunesPepi(原名ShadowRay)Pepi 是一个兼容 V2Ray 的 iOS 应用,它可以创建基于 VMess 的 VPN 连接,并与 V2Ray 服务器通信。下载:iTunesQuantumult下载:iTunesBifrostVBifrostV 是一个基于 V2Ray 内核的 Android 应用,它支持 VMess、Shadowsocks、Socks 协议。下载:Play Store | APK PureV2RayNG下载:Play Store | GitHub在线工具/资源VeekXT V2Ray配置生成支持 4.x 版本的配置文件生成器 veekxt.comV2Ray 配置生成器静态 V2Ray 配置文件生成页面 GitHubUUID GeneratorVMess User ID 生成工具 uuidgenerator.netvTemplate 项目仓库一个 V2Ray 配置文件模板收集仓库 GitHub配置信息参考https://toutyrater.github.io/websocket反向代理配置v2ray服务器配置{ "inbounds": [ { "port": 20001, "protocol": "vmess", "settings": { "clients": [ { "id": "b72dc422-5813-4a98-98fc-e14c3e9904d8", "alterId": 0, "email": "" } ], "decryption": "none" }, "streamSettings": { "network": "ws", "security": "none", "tlsSettings": {}, "wsSettings": { "connectionReuse": true, "path": "/blog", "headers": { "Host": "你的域名(需要配置到自己的网站上去)" } } }, "tag": "proxy" } ], "outbounds": [ { "protocol": "freedom", "settings": { "domainStrategy": "UseIP" } }, { "protocol": "blackhole", "settings": {}, "tag": "blocked" } ], "routing": { "settings": { "rules": [ { "inboundTag": [ "api" ], "outboundTag": "api", "type": "field" }, { "type": "field", "ip": [ "0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10" ], "outboundTag": "blocked" } ] }, "strategy": "rules" } } 客户端配置nginx配置中添加如下配置(拦截的相关后缀根据上边的配置自行修改)location /blog { proxy_redirect off; proxy_pass http://127.0.0.1:20001; 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; } 我使用了https协议进行伪装,自己根据自己的需求进行修改,BT面板可以直接自己进行修改 ## Publication Information - [晨辰bk](https://paragraph.com/@bk-5/): Publication homepage - [All Posts](https://paragraph.com/@bk-5/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@bk-5): Subscribe to updates - [Twitter](https://twitter.com/Cyyer6): Follow on Twitter