V2Ray一键脚本

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

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被墙。

客户端下载

接下来是科学上网最后一步:下载客户端,并参考页面中的配置教程进行配置:

v2ray windows客户端下载

v2ray安卓客户端下载

v2ray mac客户端下载

v2ray ios客户端下载

下载客户端配置好后,就可以愉快的上外网了!

参考

1. v2ray教程

2. VLESS协议介绍及使用教程

《V2Ray一键脚本》上有372条评论

  1. 安装完成这个,我服务器有其他的网站,申请SSL证书本来申请的是其他地址的但是证书显示到了这个虚拟网站了,反而这个伪装网站进去安全,我的网站进去浏览器提升是不安全的了,这个怎么解决?

      1. 我用的是宝塔管理,具体需要怎么手动配置其他网站呢?证书是在宝塔一键申请的,填写的是我其他网站的地址,但是浏览器浏览这个网站是不安全的,证书地址显示是伪装网站的地址,伪装网站反而是安全的。麻烦大佬说明一下。谢谢,新人不太懂。

        1. 就是你要在宝塔里编辑一下原来网站的那个配置文件,ssl_certificate和ssl_certificate_key那两行要设置成你原来网站的证书

  2. bitvise已经log in 在系统里ping了google没问题
    winxray也启动服务代理器成功 状态正常 但是浏览器就是连不上= =
    一样的服务器在ios上面就可以 请问可能是哪里的问题呢 谢谢

    1. 可能是系统防火墙没开放端口,比如说vultr开一个服安装centos8,v2ray端口1234,可能是vultr防火墙没开端口1234,也可能是centos8防火墙没开1234

  3. – Logs begin at Sun 2021-03-07 09:34:53 CST, end at Sun 2021-03-07 16:57:08 CST. —
    Mar 07 09:52:19 VM-4-8-centos v2ray[28440]: A unified platform for anti-censorship.
    Mar 07 09:52:19 VM-4-8-centos v2ray[28440]: 2021/03/07 09:52:19 [Info] v2ray.com/core/main/jsonem: Reading config: /etc/v2ray/config.json
    Mar 07 09:52:19 VM-4-8-centos v2ray[28440]: 2021/03/07 09:52:19 [Warning] v2ray.com/core: V2Ray 4.34.0 started
    Mar 07 10:04:38 VM-4-8-centos systemd[1]: Stopping V2Ray Service…
    — Subject: Unit v2ray.service has begun shutting down
    — Defined-By: systemd
    — Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

    — Unit v2ray.service has begun shutting down.
    Mar 07 10:04:38 VM-4-8-centos systemd[1]: Stopped V2Ray Service.
    — Subject: Unit v2ray.service has finished shutting down
    — Defined-By: systemd
    — Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

    — Unit v2ray.service has finished shutting down.啟動電腦端就會自動停止,是怎麼回事呢

  4. 安装结束后忘了保存最后的配置信息,应该如何查看呀,纯小白,望大神搭救

  5. 请问大神,运行脚本到安装V2ray这一步,出现如下错误该如何解决?
    (Ubuntu 18.04)

    安装V2ray…
    安装V2Ray vhttps://api.github.com/repos/v2fly/v2ray-core/releases/39396210 ,架构64
    下载V2Ray: https://github.com/v2fly/v2ray-core/releases/download/vhttps://api.github.com/repos/v2fly/v2ray-core/releases/39396210/v2ray-linux-64.zip
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 9 100 9 0 0 36 0 –:–:– –:–:– –:–:– 36
    Archive: /tmp/v2ray/v2ray.zip
    End-of-central-directory signature not found. Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive. In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.
    unzip: cannot find zipfile directory in one of /tmp/v2ray/v2ray.zip or
    /tmp/v2ray/v2ray.zip.zip, and cannot find /tmp/v2ray/v2ray.zip.ZIP, period.
    cp: cannot stat ‘/tmp/v2ray/v2ctl’: No such file or directory
    cp: cannot stat ‘/tmp/v2ray/v2ray’: No such file or directory
    cp: cannot stat ‘/tmp/v2ray/geo*’: No such file or directory
    chmod: cannot access ‘/usr/bin/v2ray/v2ray’: No such file or directory
    chmod: cannot access ‘/usr/bin/v2ray/v2ctl’: No such file or directory

      1. 同样问题,运行了你说的命令,依旧是v2ray安装失败。我是搭建回国v2ray,腾讯云广州,选了最简单的vmess(选项1)。
        cp: cannot stat ‘/tmp/v2ray/v2ctl’: No such file or directory
        chmod: cannot access ‘/usr/bin/v2ray/v2ctl’: No such file or directory

  6. Create new order error. Le_OrderFinalize not found. {
    “type”: “urn:ietf:params:acme:error:rateLimited”,
    “detail”: “Error creating new order :: too many certificates already issued for exact set of domains: http://www.wxjg.club: see https://letsencrypt.org/docs/rate-limits/“,
    “status”: 429
    }
    [Mon 08 Mar 2021 05:05:50 PM CST] Please add ‘–debug’ or ‘–log’ to check more details.
    [Mon 08 Mar 2021 05:05:50 PM CST] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh
    [Mon 08 Mar 2021 05:05:50 PM CST] Run post hook:’systemctl restart nginx’
    获取证书失败,请复制上面的红色文字到 https://hijk.art 反馈

  7. 都安裝好了,客服端也設置好了,偽裝網站瀏覽正常。但是客戶端只有上傳數據,沒有下載數據,是什麼情況。查日誌:Logs begin at Sun 2021-03-14 00:59:01 CST, end at Sun 2021-03-14 11:11:56 CST. —
    — No entries —

  8. 021/03/14 12:33:16 127.0.0.1:56783 accepted //www.youtube.com:443 [http -> proxy]
    2021/03/14 12:33:24 [Warning] [1555754184] 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://43.128.9.238:5634/89asdfg): > dial tcp 43.128.9.238:5634: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://43.128.9.238:5634/89asdfg): > dial tcp 43.128.9.238:5634: operation was canceled] > common/retry: all retry attempts failed
    2021/03/14 12:33:27 127.0.0.1:56789 accepted //www.youtube.com:443 [http -> proxy]客服端日誌

  9. 配置完了,也ping得通,但是访问网页时一直提示【打不开网页,服务器已停止响应】。
    日志的警告是
    Mar 24 23:14:15 sakura.ne.jp v2ray[886]: 2021/03/24 23:14:15 [Warning] [2371367885] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/vless/inbound: failed to find the default “alpn” config

  10. Xray 1.3.1 (Xray, Penetrates Everything.) Custom (go1.16 windows/amd64)
    A unified platform for anti-censorship.
    2021/03/25 15:29:03 [Warning] core: Xray 1.3.1 started
    2021/03/25 15:29:03 [Info] infra/conf/serial: Reading config: E:\xray-core\config.json
    2021/03/25 15:29:03 127.0.0.1:50514 accepted //www.google.com:443 [http_proxy >> proxy]
    2021/03/25 15:29:03 Using default config: E:\xray-core\config.json

    请问这个该怎么处理啊?

  11. [Sat Mar 27 10:45:49 EDT 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 56
    [Sat Mar 27 10:45:49 EDT 2021] Getting webroot for domain=’www.sssnec.top’
    [Sat Mar 27 10:45:49 EDT 2021] get to authz error.
    [Sat Mar 27 10:45:49 EDT 2021] _authorizations_map=’,

    [Sat Mar 27 10:45:49 EDT 2021] Please add ‘–debug’ or ‘–log’ to check more details.
    [Sat Mar 27 10:45:49 EDT 2021] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh
    [Sat Mar 27 10:45:49 EDT 2021] Run post hook:’systemctl restart nginx’
    获取证书失败,请复制上面的红色文字到 https://hijk.art 反馈

    好麻烦,重启服务器前装一次,重启服务器后装一次,显示的问题还不一样,请问怎么解决?

          1. 只有如下这一个地方设置端口:
            请输入v2ray监听端口[强烈建议443,默认443]:88
            v2ray端口:88
            但是后续启动后,还是另外占用了80、81端口,我的意思时能否不用这个80端口呢?
            感谢指导

  12. 我是小白,问一下伪装域名是什么。一键脚本需要伪装域名,不知道填什么。

发表回复

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