V2ray多合一脚本,支持VMESS+websocket+TLS+Nginx、VLESS+TCP+XTLS、VLESS+TCP+TLS等组合

2020.12.05更新:最新版V2ray-core已经移除了XTLS,如果你要使用XTLS技术,推荐用 Xray一键脚本

今天抽空把支持V2ray最新VLESS协议一键脚本弄完了。本次的V2ray一键脚本功能强大,支持常规VMESS协议、VMESS+websocket+TLS+Nginx、VLESS+TCP+XTLS、VLESS+TCP+TLS等多种组合,支持CentOS 7/8、Ubuntu 16.04以上、Debian 8以上系统,以及相关衍生系统。

注意:目前CentOS7系统已经到生命周期,不建议使用该系统,可能会导致脚本运行失败!建议使用Debian或者Ubuntu系统。

V2ray VLESS+TCP+XTLS一键脚本

V2ray一键脚本使用步骤如下:

1. 准备一个境外服务器,想服务器速度快请参考 搬瓦工VPS购买教程 或从  CN2 GIA VPS商家推荐 选购,想ip被封后免费换请参考:购买vultr服务器超详细图文教程

如果用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一键脚本安装菜单

V2ray一键脚本安装菜单

目前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,然后回车。接着脚本会让你输入一些信息,也可以直接按回车使用默认值。需要注意的是,对于要输入伪装域名的情况,如果服务器上有网站在运行,请联系运维再执行脚本,否则可能导致原来网站无法访问!

VLESS+TCP+XTLS一键脚本输入信息

VLESS+TCP+XTLS一键脚本输入信息

6. 脚本接下来会自动运行,一切顺利的话结束后会输出配置信息:

VLESS+TCP+XTLS一键脚本输出信息

VLESS+TCP+XTLS一键脚本输出信息

注意,脚本不适用最新版,原因是脚本在安装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一键脚本
  2. V2ray带伪装一键脚本
  3. V2ray的VLESS协议介绍和使用教程
  4. VLESS协议的fallback参数详解

《V2ray多合一脚本,支持VMESS+websocket+TLS+Nginx、VLESS+TCP+XTLS、VLESS+TCP+TLS等组合》上有781条评论

  1. 昨天vultr上买了个vps,用shadowsocksR开了服务端,结果上了一会,发现端口被墙了,换了个端口,上youtube,今天发现又被墙了,而且ip也被墙了。买个域名,再使用v2ray的VLESS+TCP+XTLS方式能解决被墙的问题吗?

  2. 老哥这什么情况

    2021/05/20 01:26:15 127.0.0.1:10051 accepted //clients2.google.com:443 [http -> proxy]
    2021/05/20 01:26:15 127.0.0.1:10053 accepted //clients2.google.com:443 [http -> proxy]
    2021/05/20 01:26:17 127.0.0.1:10055 accepted //beacons3.gvt2.com:443 [http -> proxy]
    2021/05/20 01:26:17 127.0.0.1:10057 accepted //beacons3.gvt2.com:443 [http -> proxy]
    2021/05/20 01:26:22 127.0.0.1:10061 accepted //beacons4.gvt2.com:443 [http -> proxy]
    2021/05/20 01:26:23 127.0.0.1:10063 accepted //beacons4.gvt2.com:443 [http -> proxy]
    2021/05/20 01:26:23 127.0.0.1:10065 accepted //v2xtls.org:443 [http >> proxy]
    2021/05/20 01:26:24 127.0.0.1:10067 accepted //v2xtls.org:443 [http >> proxy]
    2021/05/20 01:26:24 127.0.0.1:10069 accepted //beacons.gvt2.com:443 [http -> proxy]
    2021/05/20 01:26:24 127.0.0.1:10071 accepted //beacons.gvt2.com:443 [http -> proxy]

    — Logs begin at Thu 2021-05-20 01:13:03 CST, end at Thu 2021-05-20 01:25:27 CST. —
    May 20 01:25:15 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:15 [Warning] [4184781338] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:15 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:15 [Warning] [1267454551] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:15 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:15 [Warning] [1627527476] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:15 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:15 [Warning] [3953453376] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:17 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:17 [Warning] [1164335683] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:17 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:17 [Warning] [3952043988] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:17 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:17 [Warning] [2232573215] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:17 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:17 [Warning] [2747987298] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:23 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:23 [Warning] [3360155903] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config
    May 20 01:25:23 racknerd-c01ff0 v2ray[1455]: 2021/05/20 01:25:23 [Warning] [1077607574] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default “alpn” config

  3. 安装好了, v2ray启动失败,请检查日志或查看端口是否被占用!
    日志:
    — Logs begin at Wed 2021-05-26 10:59:14 CST, end at Wed 2021-05-26 11:10:15 CST. —
    5月 26 11:09:11 server v2ray[20616]: 2021/05/26 11:09:11 [Info] main/jsonem: Reading config: /usr/local/etc/v2ray/config.json
    5月 26 11:09:11 server v2ray[20616]: 2021/05/26 11:09:11 [Warning] V2Ray 4.38.3 started
    5月 26 11:10:15 server systemd[1]: Stopping V2ray Service…
    — Subject: v2ray.service 单元已开始停止操作
    — Defined-By: systemd
    — Support: https://access.redhat.com/support

    — v2ray.service 单元已开始停止操作。
    5月 26 11:10:15 server systemd[1]: v2ray.service: Succeeded.
    — Subject: Unit succeeded
    — Defined-By: systemd
    — Support: https://access.redhat.com/support

    — The unit v2ray.service has successfully entered the ‘dead’ state.
    5月 26 11:10:15 server systemd[1]: Stopped V2ray Service.
    — Subject: v2ray.service 单元已结束停止操作
    — Defined-By: systemd
    — Support: https://access.redhat.com/support

    — v2ray.service 单元已结束停止操作。
    5月 26 11:10:15 server systemd[1]: Started V2ray Service.
    — Subject: v2ray.service 单元已结束启动
    — Defined-By: systemd
    — Support: https://access.redhat.com/support

    — v2ray.service 单元已结束启动。

    — 启动结果为“done”。
    5月 26 11:10:15 server v2ray[22608]: V2Ray 4.38.3 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.16.3 linux/amd64)
    5月 26 11:10:15 server v2ray[22608]: A unified platform for anti-censorship.
    5月 26 11:10:15 server v2ray[22608]: 2021/05/26 11:10:15 [Info] main/jsonem: Reading config: /usr/local/etc/v2ray/config.json
    5月 26 11:10:15 server v2ray[22608]: 2021/05/26 11:10:15 [Warning] V2Ray 4.38.3 started

  4. 站长好,请教一下我之前用的SSR网速一直很好,最近用不了就换成VLESS+TCP+XLTS,但是感觉换了之后网速变慢了很多是什么原因呢?谢谢

    1. 我看了你之前回复别人的解决办法,系统重装了,也重新运行了脚本,问题还是没有解决

      1. 站长,我又来了,我用PING.GD测出来搬瓦工IP和SSH端口都没问题,为什么VLESS+XTLS昨晚上突然用不了,上午又重装了Centos 7试了其他的VMESS SSR也都用不了了,请问下是哪里出问题了吗

        1. 请问问题解决了吗,我似乎遇到的也是相同的问题,提示app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [dial tcp xxx.xxx.x.xx:443: i/o timeout dial tcp xxx.xxx.x.xx:443: operation was canceled] > common/retry: all retry attempts failed

          1. 重装换了端口还是不行,最后换成ShadowsocksR/SSR一键脚本,又换成了SS客户端才好。

  5. failed to handler mux client connection > 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://140.82.21.65/ws/JBtA4FN): 404 Not Found > websocket: bad handshake] > common/retry: all retry attempts failed

          1. 纯小白,请问可以指路一下配置方式吗?
            因为使用一键配置代码的时候在伪装这一步填的网站的dns必须指向服务器。
            但是免流的伪装一般是在v2rayNG的伪装域名使用运营商网站节点或者定向app节点来混淆实现免流。这一步就跟一键配置代码冲突了。
            难道是要选最基础的VMESS这种不需要域名的配置方式才能实现免流混淆吗?

            谢谢

          2. 补充一下:
            比如我想通过ws以pull.free.video.10010.com来伪装应该怎么操作呀,谢谢

  6. 博主,问个问题,最近我手机用V2ray刚开始一会有网,后面就断了,没网速。过一段时间在重新开启V2ray又是刚开始一会有网,看样子不是IP被墙。

  7. 安装nginx…
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base: repos.lax.layerhost.com
    * elrepo: repos.lax-noc.com
    * epel: d2lzkl7pfhq30w.cloudfront.net
    * extras: mirror.centos.lax1.serverforge.org
    * updates: mirrors.raystedman.org
    Package epel-release-7-13.noarch already installed and latest version
    Nothing to do
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base: repos.lax.layerhost.com
    * elrepo: repos.lax-noc.com
    * epel: d2lzkl7pfhq30w.cloudfront.net
    * extras: mirror.centos.lax1.serverforge.org
    * updates: mirrors.raystedman.org
    Resolving Dependencies
    –> Running transaction check
    —> Package nginx.x86_64 1:1.20.1-2.el7 will be installed
    –> Finished Dependency Resolution

    Dependencies Resolved

    ====================================================================================================
    Package Arch Version Repository Size
    ====================================================================================================
    Installing:
    nginx x86_64 1:1.20.1-2.el7 epel 586 k

    Transaction Summary
    ====================================================================================================
    Install 1 Package

    Total download size: 586 k
    Installed size: 1.7 M
    Downloading packages:
    nginx-1.20.1-2.el7.x86_64.rpm | 586 kB 00:00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
    Installing : 1:nginx-1.20.1-2.el7.x86_64 1/1
    Error unpacking rpm package 1:nginx-1.20.1-2.el7.x86_64
    warning: /etc/logrotate.d/nginx created as /etc/logrotate.d/nginx.rpmnew
    warning: /etc/nginx/nginx.conf created as /etc/nginx/nginx.conf.rpmnew
    error: unpacking of archive failed on file /usr/share/nginx/html/img: cpio: rename
    Verifying : 1:nginx-1.20.1-2.el7.x86_64 1/1

    Failed:
    nginx.x86_64 1:1.20.1-2.el7

    Complete!
    Nginx安装失败,请到 https://hijk.art 反馈

  8. 请问一下使用VMESS+WS+TLS怎么解决80端口被占用的问题呢?443可以连通但是80不行

  9. 您好!极其感谢!!已经在电脑上搞定了
    是安装的VLESS+TCP+XTLS版
    想请问一下 使用的时候需不需要考虑“浏览国内网站关代理 浏览外网才开”的问题 还是说它会自动切换?
    以及 如果我想在手机和电脑上都用的话 配置上需不需要做什么改动?就需不需要设置多个端口之类的。。?

    1. 设置好代理模式后,会按照规则自动匹配流量。
      安装好后可以多个设备同时使用,不需要其他射者

  10. 大佬我用的vless+ws的,安装好了v2ray也运行了的。运行网都没有,啥网站都打不开,然后用脚本搭那个网站也访问不到是什么情况鸭,我用了cloudfare加速的。谢谢

  11. 大佬,申请ssl证书后,打开自己域名网站显示协议不受支持,打不开,这种应该怎么办?

      1. nigix安装失败,这个搞定了,直接改了文件。
        另外提到证书申请失败,这个域名之前用过一次v2ray,是不是要一个新的域名?

  12. 大佬,我自己的节点上不去这个网站,报错信息是
    2021/08/22 21:57:20 127.0.0.1:53239 accepted http://erogamescape.dyndns.org/ [http -> proxy]
    2021/08/22 21:57:20 [Warning] [252300693] proxy/http: failed to read response from erogamescape.dyndns.org > io: read/write on closed pipe
    2021/08/22 21:57:20 [Warning] [252300693] app/proxyman/inbound: connection ends > proxy/http: connection ends > proxy/http: failed to write response > write tcp 127.0.0.1:10809->127.0.0.1:64442: wsasend: An established connection was aborted by the software in your host machine.

  13. 感谢大佬,vless+tcp+xtls,安装成功,伪装网站也能正常打开,手机端 v2rayNG 可以连上正常使用,但是windows上 v2rayN 客户端却不行,测试连接延迟提示connection closed,测试下载速度提示服务器返回503,不知道是什么原因?谢谢!

  14. 大佬 ,帮忙看看 VMESS+websocket+TLS+Nginx安装成功,
    浏览器访问icloud8.cc 失败,提示:
    此网站无法提供安全连接icloud8.cc 使用了不受支持的协议。
    ERR_SSL_VERSION_OR_CIPHER_MISMATCH

    在服务器上访问localhost页面是成功的,但是无法访问https页面

    [root@ip-172-31-33-208 ~]# curl localhost

    301 Moved Permanently

    301 Moved Permanently
    nginx

    [root@ip-172-31-33-208 ~]# curl localhost:443

    400 The plain HTTP request was sent to HTTPS port

    400 Bad Request
    The plain HTTP request was sent to HTTPS port
    nginx

    [root@ip-172-31-33-208 ~]#
    [root@ip-172-31-33-208 ~]# curl icloud8.cc

    301 Moved Permanently

    301 Moved Permanently
    nginx

    [root@ip-172-31-33-208 ~]# curl http://www.icloud8.cc

    301 Moved Permanently

    301 Moved Permanently
    nginx

    [root@ip-172-31-33-208 ~]# curl -I http://www.icloud8.cc
    HTTP/1.1 301 Moved Permanently
    Server: nginx
    Date: Sun, 05 Sep 2021 00:21:01 GMT
    Content-Type: text/html
    Content-Length: 178
    Connection: keep-alive
    Location: https://icloud8.cc:443/

    [root@ip-172-31-33-208 ~]#
    [root@ip-172-31-33-208 ~]# curl-I localhost:443
    -bash: curl-I: command not found
    [root@ip-172-31-33-208 ~]# curl -I localhost:443
    HTTP/1.1 400 Bad Request
    Server: nginx
    Date: Sun, 05 Sep 2021 01:44:32 GMT
    Content-Type: text/html; charset=utf-8
    Content-Length: 264
    Connection: close

    [root@ip-172-31-33-208 ~]#

  15. 大佬,我使用 VMESS+WS+TLS 安装成功了 ,可以正常访问https伪装页面icloud8.cc了,但是无法访问google, 辛苦帮忙看是什么原因呢?折腾几天了:(

    021/09/05 17:17:31 [Warning] [2198491002] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://18.163.187.36/myec2): > remote error: tls: handshake failure] > v2ray.com/core/common/retry: all retry attempts failed
    2021/09/05 17:17:31 [Info] [2198491002] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe

  16. 大佬,我使用 VMESS+WS+TLS 安装成功了 ,
    默认情况下我无法访问伪装页面https://icloud8.cc也无法访问google
    于是 在nginx的配置文件icloud8.cc.conf中把如下行注释掉之后,使用chrome访问伪装页面https://icloud8.cc正常
    # ssl_ecdh_curve secp384r1;
    但是使用safari访问提示此连接非私人连接告警,查看证书提示”证书输入和名称不匹配”
    同时2个浏览器都无法访问google, 辛苦帮忙看是什么原因呢?
    如果加我微信或者QQ (邮箱@前面部分就是我的QQ号)将不胜感激,我会把详细配置信息发给您。
    2021/09/05 19:52:15 [Debug] v2ray.com/core/app/log: Logger started
    2021/09/05 19:52:15 [Warning] v2ray.com/core: V2Ray 4.15.1 started
    2021/09/05 20:11:07 [Info] [4175038569] v2ray.com/core/proxy/socks: TCP Connect request to tcp:safebrowsing.googleapis.com:443
    2021/09/05 20:11:07 [Info] [4175038569] v2ray.com/core/app/dispatcher: taking detour [hongkong] for [tcp:safebrowsing.googleapis.com:443]
    2021/09/05 20:11:07 [Info] [4175038569] v2ray.com/core/transport/internet/websocket: creating connection to tcp:18.163.187.36:443
    2021/09/05 20:11:07 [Info] [4175038569] v2ray.com/core/transport/internet/websocket: creating connection to tcp:18.163.187.36:443
    2021/09/05 20:11:07 [Info] [4175038569] v2ray.com/core/transport/internet/websocket: creating connection to tcp:18.163.187.36:443
    2021/09/05 20:11:08 [Info] [4175038569] v2ray.com/core/transport/internet/websocket: creating connection to tcp:18.163.187.36:443
    2021/09/05 20:11:09 [Info] [4175038569] v2ray.com/core/transport/internet/websocket: creating connection to tcp:18.163.187.36:443
    2021/09/05 20:11:10 [Warning] [4175038569] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://18.163.187.36/IUqvwimqa): > x509: cannot validate certificate for 18.163.187.36 because it doesn’t contain any IP SANs] > v2ray.com/core/common/retry: all retry attempts failed
    2021/09/05 20:11:10 [Info] [4175038569] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注