2020.12.10更新:最新版V2ray-core已经移除了XTLS,如果你要使用XTLS技术,推荐用 Xray一键脚本
V2ray一键脚本使用教程
1. 准备一个境外服务器,想服务器速度快请参考 搬瓦工VPS购买教程 或从 CN2 GIA VPS商家推荐 选购,想ip被封后免费换请参考:购买vultr服务器超详细图文教程。
注意:目前CentOS7系统已经到生命周期,不建议使用该系统,可能会导致脚本运行失败!建议使用Debian或者Ubuntu系统。
如果用VMESS+WS+TLS或者VLESS系列协议,则还需一个域名。对域名没有要求,国内/国外注册的都可以,不需要备案,不会影响使用,也不会带来安全/隐私上的问题。购买域名可参考:Namesilo购买域名详细教程。
值得一提的是本V2ray一键脚本支持ipv6 only服务器,但是不建议用只有ipv6的VPS用来科学上网。
2. 如果vps运营商开启了防火墙(阿里云、Ucloud、腾讯云、AWS、GCP等商家默认有,搬瓦工/hostdare/vultr等商家默认关闭),请先登录vps管理后台放行80和443端口,否则可能会导致获取证书失败。此外,本脚本支持上传自定义证书,可跳过申请证书这一步,也可用在NAT VPS上。
3. ssh连接到服务器。Windows系统请参考 Bitvise连接Linux服务器教程,mac用户请参考 Mac电脑连接Linux教程。
4. 复制(或手动输入)下面命令到终端:
bash <(curl -sL https://raw.githubusercontent.com/daveleung/hijkpw-scripts-mod/main/xray_mod1.sh)
按回车键,将出现如下操作菜单。如果菜单没出现,CentOS系统请输入 yum install -y curl
,Ubuntu/Debian系统请输入 apt install -y curl
,然后再次运行上面的命令:
目前V2ray一键脚本支持以下功能:
- VMESS,即最普通的V2ray服务器,没有伪装,也不是VLESS
- VMESS+KCP,传输协议使用mKCP,VPS线路不好时可能有奇效
- VMESS+TCP+TLS,带伪装的V2ray,不能过CDN中转
- VMESS+WS+TLS,即最通用的V2ray伪装方式,能过CDN中转,推荐使用
- VLESS+KCP,传输协议使用mKCP
- VLESS+TCP+TLS,通用的VLESS版本,不能过CDN中转,但比VMESS+TCP+TLS方式性能更好
- VLESS+WS+TLS,基于websocket的V2ray伪装VLESS版本,能过CDN中转,有过CDN情况下推荐使用
- VLESS+TCP+XTLS,目前最强悍的VLESS+XTLS组合,强力推荐使用(但是支持的客户端少一些)
- trojan,轻量级的伪装协议
- trojan+XTLS,trojan加强版,使用XTLS技术提升性能
注意:目前一些客户端不支持VLESS协议,或者不支持XTLS,请按照自己的情况选择组合
5. 按照自己的需求选择一个方式。例如6,然后回车。接着脚本会让你输入一些信息,也可以直接按回车使用默认值。需要注意的是,对于要输入伪装域名的情况,如果服务器上有网站在运行,请联系运维再执行脚本,否则可能导致原来网站无法访问!
6. 脚本接下来会自动运行,一切顺利的话结束后会输出配置信息:
注意,脚本不适用最新版,原因是脚本在安装v2ray过程中,第822行默认从(https://github.com/v2fly/v2ray-core/releases/)抓取最新版本。解压后cp到对应位置,目前的最新版本为v5.1.0。该版本解压后,没有v2ctl文件,copy失败后,导致脚本意外终止,请作者予以修正。
脚本未修正前的临时解决方法:
wget https://raw.githubusercontent.com/daveleung/hijkpw-scripts-mod/main/v2ray_mod1.sh
chmod a+x v2ray_mod1.sh
vi v2ray_mod1.sh
(将822行中的${NEW_VER}修改为v4.45.2)
./v2ray_mod1.sh
到此服务端配置完毕,服务器可能会自动重启(没提示重启则不需要),windows终端出现“disconnected”,mac出现“closed by remote host”说明服务器成功重启了。
对于VLESS协议、VMESS+WS+TLS的组合,网页上输入伪装域名,能正常打开伪装站,说明服务端已经正确配置好。如果运行过程中出现问题,请在本页面下方查找解决方法或留言。
V2ray一键脚本注意事项
服务端配置好后,如果想使用CloudFlare等CDN中转(必须是WS版才可以),请参考:使用cloudflare中转流量,拯救被墙ip。
本脚本默认使用的加速技术是BBR,换成魔改BBR/BBR Plus/锐速清参考:安装魔改BBR/BBR Plus/锐速(Lotserver)。
如果伪装站类型没有你满意的,比如你想搭建WordPress博客,请参考:V2ray伪装建站教程。
对于使用TLS的方式,脚本默认会申请域名证书,证书存放在和V2ray配置文件同一个文件夹内(即/etc/v2ray
目录下)。证书会自动更新,如果客户端突然无法使用,请打开伪装网站查看是否能正常打开。如果证书已过期,请再次运行上面的脚本重新配置。
最后,刚搭建好V2ray后不要猛上流量,否则会导致被限速、端口被墙,严重可能导致ip被墙。
客户端下载
接下来是科学上网最后一步:下载客户端,并参考页面中的配置教程进行配置:
下载客户端配置好后,就可以愉快的上外网了!
参考
1. v2ray教程
你好,想请问下安装好VLESS+TCP+XTLS后,在网页打开伪域名 403 Forbidden,这是啥原因呢,thanks~
配置成功
[] [VLESS] 22222(202***176:10278)
启动服务(2022/9/9 1:22:22)…
Xray 1.5.4 (Xray, Penetrates Everything.) Custom (go1.17.7 windows/386)
A unified platform for anti-censorship.
2022/09/09 01:22:22 [Info] infra/conf/serial: Reading config: C:\Users\lcgll\Desktop\v2rayN-v5.23\v2rayN-Core\config.json
2022/09/09 01:22:22 [Warning] core: Xray 1.5.4 started
2022/09/09 01:22:22 127.0.0.1:56930 accepted //bsc-dataseed1.binance.org:443 [proxy]
2022/09/09 01:22:22 127.0.0.1:56929 accepted //nleditor.osi.office.net:443 [proxy]
2022/09/09 01:23:06 127.0.0.1:56945 accepted //twitter.com:443 [proxy]
2022/09/09 01:23:07 127.0.0.1:56946 accepted //www.google.com:443 [proxy]
2022/09/09 01:23:07 127.0.0.1:56947 accepted //www.google.com:443 [proxy]
2022/09/09 01:23:07 127.0.0.1:56948 accepted //www.gstatic.com:443 [proxy]
2022/09/09 01:23:09 127.0.0.1:56949 accepted //twitter.com:443 [proxy]
2022/09/09 01:23:14 127.0.0.1:56950 accepted //array807.prod.do.dsp.mp.microsoft.com:443 [proxy]
2022/09/09 01:23:15 127.0.0.1:56951 accepted //www.bing.com:443 [direct]
2022/09/09 01:23:15 127.0.0.1:56953 accepted //cn.bing.com:443 [direct]
2022/09/09 01:23:17 127.0.0.1:56955 accepted //bsc-dataseed1.binance.org:443 [proxy]
2022/09/09 01:23:20 127.0.0.1:56956 accepted //www.baidu.com:443 [direct]
2022/09/09 01:23:20 127.0.0.1:56957 accepted //www.baidu.com:443 [direct]
2022/09/09 01:23:20 127.0.0.1:56958 accepted //dss0.bdstatic.com:443 [direct]
2022/09/09 01:23:20 127.0.0.1:56959 accepted //pss.bdstatic.com:443 [direct]
2022/09/09 01:23:20 127.0.0.1:56960 accepted //nav-edge.smartscreen.microsoft.com:443 [proxy]
2022/09/09 01:23:20 127.0.0.1:56965 accepted //gimg3.baidu.com:443 [direct]
2022/09/09 01:23:20 127.0.0.1:56966 accepted //hectorstatic.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56969 accepted //sp1.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56971 accepted //mbd.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56972 accepted //hpd.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56975 accepted //hpd.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56976 accepted //hpd.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56978 accepted //hpd.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56979 accepted //sp2.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56983 accepted //hpd.baidu.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56985 accepted //b.bdstatic.com:443 [direct]
2022/09/09 01:23:21 127.0.0.1:56987 accepted //passport.baidu.com:443 [direct]
2022/09/09 01:23:22 127.0.0.1:56989 accepted //sp1.baidu.com:443 [direct]
2022/09/09 01:23:22 127.0.0.1:56991 accepted //hpd.baidu.com:443 [direct]
2022/09/09 01:23:22 127.0.0.1:56993 accepted //ss0.baidu.com:443 [direct]
2022/09/09 01:23:22 127.0.0.1:56994 accepted //ss1.baidu.com:443 [direct]
2022/09/09 01:23:22 127.0.0.1:56995 accepted //ss2.baidu.com:443 [direct]
2022/09/09 01:23:22 127.0.0.1:56996 accepted //ss3.baidu.com:443 [direct]
2022/09/09 01:23:24 127.0.0.1:57001 accepted //nleditor.osi.office.net:443 [proxy]
2022/09/09 01:23:25 127.0.0.1:57002 accepted //t10.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57003 accepted //fclick.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57004 accepted //fclick.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57005 accepted //fclick.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57006 accepted //paimgcdn.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57008 accepted //bkssl.bdimg.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57012 accepted //hpd.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57016 accepted //baikebcs.bdimg.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57018 accepted //ug.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57020 accepted //ug.baidu.com:443 [direct]
2022/09/09 01:23:25 127.0.0.1:57022 accepted //api.segment.io:443 [block]
2022/09/09 01:23:25 127.0.0.1:57023 accepted //api.segment.io:443 [block]
2022/09/09 01:23:37 127.0.0.1:57024 accepted http://edge-http.microsoft.com/captiveportal/generate_204 [proxy]
2022/09/09 01:23:48 127.0.0.1:57025 accepted //bsc-dataseed1.binance.org:443 [proxy]
2022/09/09 01:23:58 127.0.0.1:57026 accepted //nleditor.osi.office.net:443 [proxy]
2022/09/09 01:24:07 [Warning] [2270623525] proxy/http: failed to read response from edge-http.microsoft.com > io: read/write on closed pipe
2022/09/09 01:24:19 127.0.0.1:57027 accepted //bsc-dataseed1.binance.org:443 [proxy]
2022/09/09 01:24:28 127.0.0.1:57028 accepted //nleditor.osi.office.net:443 [proxy]
脚本已经不能用了,用来搭建腾讯云出现错误,
大佬尽快这个脚本问题啊,已经不能使用了,搭建不了VPS
仔细看文章中的说明
脚本未修正前的临时解决方法:
wget https://raw.githubusercontent.com/daveleung/hijkpw-scripts-mod/main/v2ray_mod1.sh
chmod a+x v2ray_mod1.sh
vi v2ray_mod1.sh
(将822行中的${NEW_VER}修改为v4.45.2)
./v2ray_mod1.sh
老师,这个解决方法看不懂,是直接复制吗?望回复,感谢!
网上找找其他脚本
嗯嗯好的 感谢您的回复 我已经找到新的脚本了。
修复了
可用呀,修复了
用一键脚本安装trojan到最后显示如下:
cp: cannot stat ‘/tmp/v2ray/v2ctl’: No such file or directory
chmod: cannot access ‘/usr/bin/v2ray/v2ctl’: No such file or directory
v2ray安装失败
请问这是什么情况,谢谢!
v2ray版本太新的不合适,要用老版本
https://github.com/v2fly/v2ray-core/releases
手动改下脚本下载的版本
installV2ray() {
rm -rf /tmp/v2ray
mkdir -p /tmp/v2ray
DOWNLOAD_LINK=”${V6_PROXY}https://github.com/v2fly/v2ray-core/releases/download/${NEW_VER}/v2ray-linux-$(archAffix).zip”
近期 V2RAY 已安装未运行; 重启提示端口被占用 该怎么解决呀@老大
重新运行脚本,换个端口
开放端口
开放端口是啥意思 ;
Fri Oct 21 16:57:34 CST 2022] Create new order error. Le_OrderFinalize not found. {
“type”: “urn:ietf:params:acme:error:malformed”,
“detail”: “NewOrder request included invalid non-DNS type identifier: type \”ip\”, value \”192.3.150.33\””,
“status”: 400
}
[Fri Oct 21 16:57:34 CST 2022] Please add ‘–debug’ or ‘–log’ to check more details.
[Fri Oct 21 16:57:34 CST 2022] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh
出现了这些红字是什么原因
服务器换个系统或者升级一下系统
你好,我最近使用脚本装好服务端之后,在shoadowrocket上面是能测通的,但是一旦开启使用了,就测不通了。关闭连接一会之后又能测通,但就是开启连接就马上不通了。使用的是vultr的月付5美刀的服务器。这个有解决的办法吗?
前几天还正常用,这几天突然不能用了,在服务器重启了v2ray之后无法启动、请问下是什么原因导致的。
— Logs begin at Wed 2022-10-26 08:40:32 EDT, end at Thu 2022-10-27 08:16:32 EDT. —
Oct 27 08:16:31 brave-hats-2.localdomain v2ray[8851]: main.main()
Oct 27 08:16:31 brave-hats-2.localdomain v2ray[8851]: v2ray.com/core/main/main.go:143 +0xb1
Oct 27 08:16:31 brave-hats-2.localdomain systemd[1]: v2ray.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 27 08:16:31 brave-hats-2.localdomain systemd[1]: v2ray.service: Failed with result ‘exit-code’.
Oct 27 08:16:32 brave-hats-2.localdomain systemd[1]: v2ray.service: Service RestartSec=100ms expired, scheduling restart.
Oct 27 08:16:32 brave-hats-2.localdomain systemd[1]: v2ray.service: Scheduled restart job, restart counter is at 5.
— Subject: Automatic restarting of a unit has been scheduled
— Defined-By: systemd
— Support: https://access.redhat.com/support
—
— Automatic restarting of the unit v2ray.service has been scheduled, as the result for
— the configured Restart= setting for the unit.
Oct 27 08:16:32 brave-hats-2.localdomain systemd[1]: Stopped V2ray Service.
— Subject: Unit v2ray.service has finished shutting down
— Defined-By: systemd
— Support: https://access.redhat.com/support
—
— Unit v2ray.service has finished shutting down.
Oct 27 08:16:32 brave-hats-2.localdomain systemd[1]: v2ray.service: Start request repeated too quickly.
Oct 27 08:16:32 brave-hats-2.localdomain systemd[1]: v2ray.service: Failed with result ‘exit-code’.
Oct 27 08:16:32 brave-hats-2.localdomain systemd[1]: Failed to start V2ray Service.
— Subject: Unit v2ray.service has failed
— Defined-By: systemd
— Support: https://access.redhat.com/support
—
— Unit v2ray.service has failed.
—
— The result is RESULT.
VLESS+TCP+XTLS方式没有提供VLESS订阅链接吗,那就不方便转成clash了
有呀
最常规的VMESS
安装好正常启动,但是我用mac,windows,小火箭都没发连接谷歌
应该是配置错了
2022/12/04 04:16:21 127.0.0.1:62790 accepted //signaler-pa.clients6.google.com:443 [http -> proxy]
2022/12/04 04:16:23 127.0.0.1:62796 accepted //ssl.gstatic.com:443 [http -> proxy]
2022/12/04 04:16:24 [Warning] [1803951675] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: operation was canceled transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp: lookup http://www.rosso88.shop: operation was canceled] > common/retry: all retry attempts failed
2022/12/04 04:16:24 [Warning] [1303209075] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: operation was canceled transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp: lookup http://www.rosso88.shop: operation was canceled] > common/retry: all retry attempts failed
2022/12/04 04:16:24 [Warning] [686228613] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: operation was canceled transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp: lookup http://www.rosso88.shop: operation was canceled] > common/retry: all retry attempts failed
2022/12/04 04:16:24 [Warning] [903362207] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp 47.242.xxx.147:11633: operation was canceled transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://www.rosso88.shop:11633/naiyou123): > dial tcp: lookup http://www.rosso88.shop: operation was canceled] > common/retry: all retry attempts failed
2022/12/04 04:16:24 127.0.0.1:62799 accepted //play.google.com:443 [http -> proxy]
请问我这是什么问题。我按照youtube 视频,每一步都是对的。 但是最终还是这样。 我重装好几次了
在搬瓦工上搭的V2ray服务4:VMESS只能在PC端连客户端访问,ios移动端用多款客户端都连接不上,tcp连接又是通的;在vultr上搭的一模一样的服务,PC端和移动端都能正常访问。
百思不得其解,不能访问的那台,看nginx日志也没报错,正常在接收请求;最后比较搬瓦工与vultr上xray的版本有点区别,前者是:1.7.5,后者是:1.4.2。但是安装的linux版本都是Debian 11 x64啊。
请问下,这是何解?
盼指教,谢谢!
可能你用的脚本不一样
已经维护更新了
请问,在执行脚本后要求我输入伪装域名,是什么导致需要输入伪装域名,还有伪装域名怎么设置?
伪装需要伪装域名,没有域名不要选带TLS的
bash <(curl -Ls https://raw.githubusercontent.com/wurendi001/hijkpw/main/v2ray_mod1.sh)
更新的
通知: 已升到v2ray5.2.1版
通知: 从4.32.1之后没xtls协议了想用xtls去使用xray脚本
我更新了希望站长换上
已经更新
有什么问题?
您好,收到报错
/dev/fd/63: line 1876: syntax error: unexpected end of file
请问要怎么解决呀
重新运行
https://raw.githubusercontent.com/wurendi001/hijkpw/main/v2ray_mod1.sh
这个挂了
已经修复了
搭完后 如何查看 服务器后台是否在运行呢 用V2ary连不上是为什么呢
重新运行一键脚本,选择查看信息
更新修复好了,xray和v2ray合为一体的综合一键代码 bash <(curl -s -L https://urlzs.com/S66cM)