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等组合》上有771条评论

  1. nginx: [error] open() “/www/server/nginx/logs/nginx.pid” failed (2: No such file or directory)
    v2ray启动失败,请检查日志或查看端口是否被占用!

  2. V2ray-VMESS+WS+TLS突然之间不可用,重新安装后,windows客户端可用,mac客户端不可用,且双端均无法telnet通端口,伪装地址双端无法访问,这是什么原因呢

    1. 如果win客户端能用,那么不可能双端地址都无法访问;如果双端地址都无法访问,那么win就不能用,你的问题应该是某一个客户端配置错了

  3. 在输入域名后一直提示IP未关联域名,但是ping的到,使用其他脚本未出现错误提示,是哪里出了问题么?

  4. 用你的脚本安装成功也能正常上网 为什么再次使用脚本提示我脚本未安装?

  5. 为何脚本使用后域名变成了一个奇怪的网站 而不是什么壁纸网站?以下是网站内容
    这是什么网页?为何我到这儿啦?

    这是个在全球(含中国大陆)合法合规运营的域名停放(Domain Name Parking)网页(系统),有数百万个暂时闲置的域名由其最新注册人/管理者自愿解析呈现。

    反诈/刑侦/网警/网信查案至此,可否配合执法或相关调查?

    必须可以👍

    如在以下的答疑中未解惑,请直接联络我们表明身份,经确认相关证件及案件的合法有效后定当全力协助!

    数年间,已为天津、湖南、北京、河南、吉林、新疆等诸多地区/直辖市/省份/自治区的公安刑侦部门在案情侦破过程中无偿提供过技术支持……

    能否找到某个停放域名(网站)中曾经存在的相关资源或联络方式?

    估计不行,至少是我们无法做到的,建议尝试在互联网档案馆(Internet Archive)或其它商业运营的WHOIS历史查询系统中翻查!

    域名被解析至此(停放页)的,要么域名主人(站长)放弃网站了,要么域名通过交易而易主了,甚至到期未续费被删除(又有他人重新注册)了!

    可通过WHOIS查询到的域名注册日期对比分析来判断!

    为何“我的域名”被跳转至此?

    当遇此问题,基本上相关域名已不属于您,请回忆下是否忘记续费或主动放弃了?

    猜测系其新主人(域名注册者)将域名停放了!

    如确认并非如我们猜测,域名依然属您所有,建议立即报警!

    “我的域名”停放在海外平台的,为何会跳转至此?

    那是因为您所停放的平台与我们有合作,将中国大陆地区的访问量跳转至此。

    相信您也有获得相关的广告分成!

    为何有时网页中间区域完全空白?

    我们的系统具备专业的反作弊技术,当访问请求触发了“防恶意刷新”机制时页面中不会展现任何广告(空白区域)。

    如何求购相关域名?可否代购?

    在此,我们并不专门提供域名代购服务;

    出于隐私保护或合作层级并不单一等原因,我们也无法提供/获取域名主人的有效联络资料;

    即使我们代劳,也需诸多人工介入工作,而且还无法保障成功(跟您自己联络相比,我们的优势也仅仅是多些经验而已);

    如预算充足,愿意承担至少人民币四位数的基础服务费(成败均不退)及成交佣金(交易额的10%起),可尝试联络我们!

    也有域名暂时闲置中,可否停放于此?

    可尝试点击这里找寻相关答案。

    可否在此网页上刊登广告,推广业务?

    当然可以!

    如有合法合规(具备网络备案及相关资质)的在线业务需推广,欢迎联络👏

    QQ/Email:9081191@qq.com 当您仔细阅读 👆 问答后仍有疑问时再联络。谢谢!

    微信/手机:13903050?0? 办案配合专线!为防骚扰,烦请办案人员在网络备案系统中查看隐藏的两位数字。如遇信号不畅,直接表明身份加微信(同手机号)就行!

  6. 大佬,按照VMESS+WS+TLS配置的,cloudflare的CDN。网页在墙内无法访问,但是使用nekoray就能打开。v2rayn(v6.31)报错,是GW又有什么新设置吗?
    配置成功
    [VMess] mydomain.com(***work:443)
    启动服务(2023/12/26 14:27:36)…
    2023/12/26 14:27:36 系统代理设置改变ForcedChange
    2023/12/26 14:27:38 系统代理设置改变ForcedChange
    Xray 1.8.4 (Xray, Penetrates Everything.) Custom (go1.21.0 windows/amd64)
    A unified platform for anti-censorship.
    2023/12/26 14:27:39 Using default config: C:\Users\htsc\Downloads\v2rayN-With-Core\v2rayN-With-Core\guiConfigs\config.json
    2023/12/26 14:27:39 [Info] infra/conf/serial: Reading config: C:\Users\htsc\Downloads\v2rayN-With-Core\v2rayN-With-Core\guiConfigs\config.json
    2023/12/26 14:27:39 [Warning] core: Xray 1.8.4 started
    2023/12/26 14:27:41 127.0.0.1:63368 accepted //www.google.com:443 [http -> proxy]
    2023/12/26 14:27:45 [Warning] [3414842157] app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://mydomain.com/hYjk4s): > read tcp 172.20.10.14:63369->172.67.137.230:443: wsarecv: An existing connection was forcibly closed by the remote host. transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://mydomain.com/hYjk4s): > read tcp 172.20.10.14:63370->172.67.137.230:443: wsarecv: An existing connection was forcibly closed by the remote host. transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://mydomain.com/hYjk4s): > read tcp 172.20.10.14:63371->172.67.137.230:443: wsarecv: An existing connection was forcibly closed by the remote host. transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://mydomain.com/hYjk4s): > read tcp 172.20.10.14:63372->172.67.137.230:443: wsarecv: An existing connection was forcibly closed by the remote host. transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://mydomain.com/hYjk4s): > read tcp 172.20.10.14:63373->172.67.137.230:443: wsarecv: An existing connection was forcibly closed by the remote host.] > common/retry: all retry attempts failed
    2023/12/26 14:27:45 当前服务的真连接延迟: -1 ms

      1. 多谢回复。端口确定是443,如果区域存在tls阻断需要怎么处理?只能用http伪装吗?
        因为刚搭建的时候是好的,两天后才开始无法连接,我也怀疑是gw作妖了

  7. 大佬,最近搭建完成后都可以使用,第二天就坏了,没用443端口,再次搭建换端口也是两天的寿命。。。是什么原因?麻烦大佬

      1. 使用的是4. 安装Xray-VMESS+WS+TLS(推荐),因为用的v2rayU所以别的我都用补了。。麻烦大佬帮看看

  8. 你好,安装成功了但是运行不了

    Xray运行状态:已安装 未运行

    尝试运行则显示: Xray启动失败,请检查日志或查看端口是否被占用!

    日志:
    Feb 16 23:14:07 core-machine-1.localdomain xray[82528]: Failed to start: main: failed to load config files: [/usr/local/etc/xray/config.json] > infra/conf: Please use VLESS flow “xtls-rprx-vision” with TLS or REALITY.
    Feb 16 23:14:07 core-machine-1.localdomain systemd[1]: xray.service: Main process exited, code=exited, status=23/n/a
    ░░ Subject: Unit process exited
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ An ExecStart= process belonging to unit xray.service has exited.
    ░░
    ░░ The process’ exit code is ‘exited’ and its exit status is 23.
    Feb 16 23:14:07 core-machine-1.localdomain systemd[1]: xray.service: Failed with result ‘exit-code’.
    ░░ Subject: Unit failed
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ The unit xray.service has entered the ‘failed’ state with result ‘exit-code’.
    Feb 16 23:16:12 core-machine-1.localdomain systemd[1]: Started xray.service – Xray Service.
    ░░ Subject: A start job for unit xray.service has finished successfully
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ A start job for unit xray.service has finished successfully.
    ░░
    ░░ The job identifier is 21370.
    Feb 16 23:16:12 core-machine-1.localdomain xray[82681]: Xray 1.8.7 (Xray, Penetrates Everything.) 3f0bc13 (go1.21.5 linux/amd64)
    Feb 16 23:16:12 core-machine-1.localdomain xray[82681]: A unified platform for anti-censorship.
    Feb 16 23:16:12 core-machine-1.localdomain xray[82681]: 2024/02/16 23:16:12 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/config.json
    Feb 16 23:16:12 core-machine-1.localdomain xray[82681]: Failed to start: main: failed to load config files: [/usr/local/etc/xray/config.json] > infra/conf: Please use VLESS flow “xtls-rprx-vision” with TLS or REALITY.
    Feb 16 23:16:12 core-machine-1.localdomain systemd[1]: xray.service: Main process exited, code=exited, status=23/n/a
    ░░ Subject: Unit process exited
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ An ExecStart= process belonging to unit xray.service has exited.
    ░░
    ░░ The process’ exit code is ‘exited’ and its exit status is 23.
    Feb 16 23:16:12 core-machine-1.localdomain systemd[1]: xray.service: Failed with result ‘exit-code’.
    ░░ Subject: Unit failed
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ The unit xray.service has entered the ‘failed’ state with result ‘exit-code’.

    求助,十分感谢

        1. 您好,找到v2ray的脚本了,下载安装都没问题,但是还是上不去外网,伪装域名也打不开,如何troubleshoot呢
          日志:
          Feb 20 05:30:41 core-machine-1.localdomain systemd[1]: Started v2ray.service – V2ray Service.
          ░░ Subject: A start job for unit v2ray.service has finished successfully
          ░░ Defined-By: systemd
          ░░ Support: https://www.debian.org/support
          ░░
          ░░ A start job for unit v2ray.service has finished successfully.
          ░░
          ░░ The job identifier is 2656.
          Feb 20 05:30:41 core-machine-1.localdomain v2ray[13291]: V2Ray 4.32.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.15.4 linux/amd64)
          Feb 20 05:30:41 core-machine-1.localdomain v2ray[13291]: A unified platform for anti-censorship.
          Feb 20 05:30:41 core-machine-1.localdomain v2ray[13291]: 2024/02/20 05:30:41 [Info] v2ray.com/core/main/jsonem: Reading config: /etc/v2ray/config.json
          Feb 20 05:30:42 core-machine-1.localdomain v2ray[13291]: 2024/02/20 05:30:42 [Warning] v2ray.com/core: V2Ray 4.32.1 started

          1. 您好,卸载重装都试过了,都显示
            当前状态:已安装 V2ray正在运行

            请选择操作[0-17]:17
            Feb 22 04:12:48 core-machine-1.localdomain systemd[1]: Started v2ray.service – V2ray Service.
            ░░ Subject: A start job for unit v2ray.service has finished successfully
            ░░ Defined-By: systemd
            ░░ Support: https://www.debian.org/support
            ░░
            ░░ A start job for unit v2ray.service has finished successfully.
            ░░
            ░░ The job identifier is 2416.
            Feb 22 04:12:48 core-machine-1.localdomain v2ray[6578]: V2Ray 4.32.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.15.4 linux/amd64)
            Feb 22 04:12:48 core-machine-1.localdomain v2ray[6578]: A unified platform for anti-censorship.
            Feb 22 04:12:48 core-machine-1.localdomain v2ray[6578]: 2024/02/22 04:12:48 [Info] v2ray.com/core/main/jsonem: Reading config: /etc/v2ray/config.json
            Feb 22 04:12:48 core-machine-1.localdomain v2ray[6578]: 2024/02/22 04:12:48 [Warning] v2ray.com/core: V2Ray 4.32.1 started

            伪装域名还是打不开
            V2rayN上面反馈:
            2024/02/22 20:27:16 [Warning] [3639690333] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [dial tcp 地址:443: i/o timeout dial tcp 地址:443: operation was canceled] > common/retry: all retry attempts failed
            然后我尝试在搬瓦工上面迁移服务器,但是一直显示Migration backend is currently not available for this VPS. Please try again in 10-15 minutes. (734152)
            服务器是没问题的
            求救T_T
            感谢感谢!!

  9. 你好,安装时显示
    Failed to stop xray.service: Unit xray.service not loaded.
    其他进程占用了80或443端口,请先关闭再运行一键脚本
    端口占用信息如下:
    tcp6 0 0 :::443 :::* LISTEN 510/v2ray

    这个怎么解决呀,感谢感谢

  10. 大佬你好,系统更换了Debian9,搭设时输入apt install -y curl,提示如下:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    libcurl3
    The following NEW packages will be installed:
    curl libcurl3
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 518 kB of archives.
    After this operation, 989 kB of additional disk space will be used.
    Err:1 http://ftp.debian.org/debian stretch/main amd64 libcurl3 amd64 7.52.1-5
    404 Not Found
    Err:2 http://ftp.debian.org/debian stretch/main amd64 curl amd64 7.52.1-5
    404 Not Found
    E: Failed to fetch http://ftp.debian.org/debian/pool/main/c/curl/libcurl3_7.52.1-5_amd64.deb 404 Not Found
    E: Failed to fetch http://ftp.debian.org/debian/pool/main/c/curl/curl_7.52.1-5_amd64.deb 404 Not Found
    E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

    是不是没安装上?后面输入操作菜单是显示-bash: curl: command not found

发表回复

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