v2ray带伪装一键脚本

2020.10.26更新:推荐使用 V2ray多合一脚本,支持VMESS+websocket+TLS+Nginx、VLESS+TCP+XTLS、VLESS+TCP+TLS等组合

今天抽空完成了CentOS系统的v2ray带伪装一键安装脚本,代码已上传到 Github。本脚本能让您在服务端一键安装基于Nginx+websocket+tls的v2ray流量伪装和bbr加速模块,接下来就感受稳如狗的体验吧,再也不用担心ip被墙了!

Ubuntu系统请参考:v2ray带伪装一键脚本Ubuntu版

V2ray带伪装一键脚本使用教程

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

伪装的前提是需要一个域名(例如hijk.art),并且域名的某个主机名(例如www.hijk.art)正确解析到服务器的ip。对域名没有要求,国内/国外注册的都可以,不需要备案,不会影响使用,也不会带来安全/隐私上的问题。购买域名可参考:Namesilo购买域名详细教程。不想购买请使用常规版的一键脚本:v2ray一键脚本

值得一提的是本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. 复制(或手动输入)下面命令到终端

yum install -y curl
bash <(curl -sL https://raw.githubusercontent.com/hiifeng/v2ray/main/install_v2ray.sh) 

按回车键,脚本开始询问你一些信息,请按照提示输入,其中一些问题可直接按回车使用默认值。

注意,脚本不适用最新版,原因是脚本在安装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”或”broken pipe”),请重新连接后再次执行命令。脚本运行成功会输出配置信息,截图如下:

带伪装v2ray配置

带伪装v2ray配置

到此服务端配置完毕,服务器可能会自动重启(没提示重启则不需要),windows终端出现“disconnected”,mac出现“closed by remote host”说明服务器成功重启了。

打开浏览器输入伪装域名,能正常打开伪装站,说明服务端在正常运行;输入域名加伪装路径,出现”bad request”,则说明服务端已经完全没问题。

V2ray带伪装一键脚本其他事项

1. 查看v2ray运行状态 / 配置:bash <(curl -sL https://raw.githubusercontent.com/luciferkids/hijkpw-scripts/main/centos_install_v2ray2.sh) info

2. v2ray管理命令:启动:systemctl start v2ray,停止:systemctl stop v2ray,重启:systemctl restart v2ray

3. nginx管理命令:测试配置文件有无错误:nginx -t,启动:systemctl start nginx,停止:systemct stop nginx,重启:systemctl restart nginx

4. 更新v2ray到最新版:bash <(curl -sL https://raw.githubusercontent.com/luciferkids/hijkpw-scripts/main/goV2.sh)(提示“装不上daemon”不用管,systemctl restart v2ray重新启动v2ray就好了)

5. 伪装网站SSL证书放在配置文件的文件夹下,会自动续期;

6. 卸载: bash <(curl -sL https://raw.githubusercontent.com/luciferkids/hijkpw-scripts/main/centos_install_v2ray2.sh) uninstall

7. 建站/改伪装网站请参考:v2ray伪装建站教程

8. 搭建TG代理请参考: 一键搭建Telegram的MTProto代理

9. 希望上cdn,请根据本教程操作完后再阅读:v2ray使用cloudflare中转流量,拯救被墙ip

10. 理论上只要流量够、服务器扛得住,同一个配置支持无数人、无限设备使用。如果想为不同的人配置不同的id,请参考:v2ray多用户配置

12. 脚本默认使用BBR技术加速, BBR换成魔改BBR/BBR Plus/锐速清参考:安装魔改BBR/BBR Plus/锐速(Lotserver)

13. 搭建好伪装v2ray后建站/改伪装网站请参考:v2ray伪装建站教程

14. 刚搭建好带伪装的v2ray不要猛上流量,否则可能导致被限速、端口被墙,严重可能ip被墙。

V2ray客户端下载

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

v2ray windows客户端下载

v2ray安卓客户端下载

v2ray mac客户端下载

v2ray ios客户端下载

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

参考

1.V2ray教程

2. v2ray高级技巧:流量伪装

3. trojan一键脚本

《v2ray带伪装一键脚本》上有267条评论

  1. 请问怎么更换伪装域名?主要是里面有之前的域名证书,不知道如何清除

  2. 你好,我想问下最后结果ngnix启动失败怎么回事啊,过程一直很顺利,重新装了两次

          1. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
            nginx: configuration file /etc/nginx/nginx.conf test is successful

          2. 重新装了。还是提示nginx启动失败,执行systemctl start nginx,没反应。systemct stop nginx,-bash: systemct: command not found
            systemctl restart v2ray,也没反应

  3. systemctl restart nginx没有输出,ps aux | grep -i nginx有的,
    [Wed Jan 20 12:05:04 CST 2021] Install success!
    [Wed Jan 20 12:05:06 CST 2021] Already uptodate!
    [Wed Jan 20 12:05:06 CST 2021] Upgrade success!
    [Wed Jan 20 12:05:07 CST 2021] Domains not changed.
    [Wed Jan 20 12:05:07 CST 2021] Skip, Next renewal time is: Thu Mar 18 03:01:13 UTC 2021
    [Wed Jan 20 12:05:07 CST 2021] Add ‘–force’ to force to renew.
    [Wed Jan 20 12:05:07 CST 2021] Installing key to:/etc/v2ray/www.iuihuihjkj.xyz.key
    [Wed Jan 20 12:05:07 CST 2021] Installing full chain to:/etc/v2ray/www.iuihuihjkj.xyz.pem
    [Wed Jan 20 12:05:07 CST 2021] Run reload cmd: service nginx force-reload
    Redirecting to /bin/systemctl force-reload nginx.service
    [Wed Jan 20 12:05:07 CST 2021] Reload success
    nginx启动失败! 请到 https://www.hijk.pw 反馈
    [root@hwsrv-822612 ~]# systemctl restart nginx
    [root@hwsrv-822612 ~]# nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    [root@hwsrv-822612 ~]# systemctl start nginx
    [root@hwsrv-822612 ~]# systemct stop nginx
    -bash: systemct: command not found
    [root@hwsrv-822612 ~]# ash <(curl -sL https://s.hijk.art/centos_install_v2ray2.sh) info
    -bash: ash: command not found
    [root@hwsrv-822612 ~]# bash <(curl -sL https://s.hijk.art/centos_install_v2ray2.sh) info
    #############################################################
    # CentOS 7/8 v2ray 带伪装一键安装脚本 #
    # 作者: 网络跳越(hijk) #
    # 网址: https://hijk.art #
    # 论坛: https://hijk.club #
    # TG群: https://t.me/hijkclub #
    # Youtube频道: https://youtube.com/channel/UCYTB–VsObzepVJtc9yvUxQ #
    #############################################################

    ============================================
    v2ray运行状态:正在运行
    v2ray配置文件:/etc/v2ray/config.json
    nginx运行状态:已停止
    nginx配置文件:/etc/nginx/conf.d/www.iuihuihjkj.xyz.conf

      1. Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

        — Unit nginx.service has begun shutting down.
        Jan 20 12:24:33 hwsrv-822612.hostwindsdns.com systemd[1]: Stopped The NGINX HTTP an
        — Subject: Unit nginx.service has finished shutting down
        — Defined-By: systemd
        — Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

        — Unit nginx.service has finished shutting down.
        Jan 20 12:24:33 hwsrv-822612.hostwindsdns.com systemd[1]: Starting The NGINX HTTP a
        — Subject: Unit nginx.service has begun start-up
        — Defined-By: systemd
        — Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

        — Unit nginx.service has begun starting up.
        Jan 20 12:24:33 hwsrv-822612.hostwindsdns.com nginx[3253]: nginx: the configuration
        Jan 20 12:24:33 hwsrv-822612.hostwindsdns.com nginx[3253]: nginx: configuration fil
        Jan 20 12:24:33 hwsrv-822612.hostwindsdns.com systemd[1]: Failed to parse PID from
        Jan 20 12:24:33 hwsrv-822612.hostwindsdns.com systemd[1]: Started The NGINX HTTP an
        — Subject: Unit nginx.service has finished start-up
        — Defined-By: systemd
        — Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

        — Unit nginx.service has finished starting up.

        — The start-up result is done.
        lines 15-40/40 (END)

        1. 奇怪了,看起来完全没错误。服务器上是否运行网站,或者把服务器的ip和root密码发我,我进去看看

  4. 我记得卸载过啊,那咋整,刚找那个网站,发现数据库错误,打不开网站了

      1. 重装好几遍了,还是提示nginx启动失败,卸载也试过
        ,博主你能帮我安装不,有偿

  5. 安装之后,伪装站无法正常打开,但是VPS的IP能PING通,挂其他代理后也能打开伪装站是什么情况?

  6. 您好,之前已经装过不带伪装的一键脚本,现在装带伪装的,必须把之前安装好的一键脚本卸载么

  7. 你好,请问一下我之前的.pw的域名快过期了,所以现在重新买了一个新的.monster的域名,现在要装一键脚本的话会冲突吗(之前的还在用)?两个域名的是解析到同一个IP的

  8. 重新卸载安装运行了“v2ray带伪装一键脚本”,然后在客户端配置好后,上不了网了
    显示“建立安全连接失败
    连接到 http://www.sciencedirect.com 时发生错误。PR_END_OF_FILE_ERROR
    由于不能验证所收到的数据是否可信,无法显示您想要查看的页面。
    建议向此网站的管理员反馈这个问题。”
    请问怎么办?

      1. CentOS Linux 7 (Core) 端口号:443,伪装路径:/AI0Y9OVvAj, v2启动失败,请检查端口是否被占用或伪装 路径是否有特殊字符!!
        端口443,伪装路径直接按回车自动生成的,为什么安装失败啊,,,,求大神解答

          1. 我已安装最新版本的了。暂时可以。请问伪装网址不能打开。还有没证书。暂时可以科学上网。请问有影响吗

  9. 大佬,我的vps ip被墙了,然后用临时节点登上去运行了这个教程的v2ray脚本,再打开伪装域名,可以看到centos官网。但是用这个脚本生成的配置,v2rayn客户端还是连不上谷歌。我也用cloudflare设置过dns,然后把v2rayn里面的ip改成域名,但是还是不行,请问怎么办呀

      1. 已经先把cloudflare的dns proxy配好了。不知道v2ray客户端是不是要改ip,就试了两次。结果如下,请大佬指教:
        这里是配置ip的结果
        2021/03/16 14:18:54 [Warning] v2ray.com/core: V2Ray 4.34.0 started
        2021/03/16 14:19:06 127.0.0.1:2004 accepted //www.google.com:443 [proxy]
        2021/03/16 14:19:36 127.0.0.1:2011 accepted http://www.gstatic.com/generate_204 [proxy]
        2021/03/16 14:19:37 127.0.0.1:2013 accepted //www.google.com:443 [proxy]
        2021/03/16 14:19:39 [Warning] [1166756607] 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://144.34.174.101/tmp): > dial tcp 144.34.174.101:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://144.34.174.101/tmp): > dial tcp 144.34.174.101:443: operation was canceled] > v2ray.com/core/common/retry: all retry attempts failed

        把ip改成域名后的结果
        2021/03/16 14:22:28 [Warning] [1999450728] 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://amysmith.xyz/tmp): > read tcp 10.10.50.118:2081->104.21.84.119:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 10.10.50.118:2087->104.21.84.119:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 10.10.50.118:2091->104.21.84.119:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 10.10.50.118:2095->104.21.84.119:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > dial tcp: operation was canceled] > v2ray.com/core/common/retry: all retry attempts failed

          1. 大佬,能不能帮忙看下这是什么原因啊,1.0.0.1能ping通,但还是不行。。[吐血]

            配置:
            cloudflare partner 网站上设置的dns解析指向真实主机ip,DNSPod上设置的是:主机记录@,A记录,电信1.0.0.1,默认162.159.208.4,CNAME境外用cloudflare partner生成的CNAME

            报错信息:
            2021/03/17 08:10:56 [Warning] [3546384158] 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://amysmith.xyz/tmp): > read tcp 10.10.50.118:12890->1.0.0.1:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 10.10.50.118:12906->1.0.0.1:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 10.10.50.118:12917->1.0.0.1:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 10.10.50.118:12929->1.0.0.1:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 10.10.50.118:12937->1.0.0.1:443: i/o timeout] > v2ray.com/core/common/retry: all retry attempts failed
            2021/03/17 08:10:56 [Warning] [3546384158] v2ray.com/core/proxy/http: failed to read response from 14.tlu.dl.delivery.mp.microsoft.com > io: read/write on closed pipe
            2021/03/17 08:10:56 [Warning] [3546384158] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > v2ray.com/core/proxy/http: failed to write response > write tcp 127.0.0.1:10809->127.0.0.1:12889: wsasend: An existing connection was forcibly closed by the remote host.

          2. 用的电信宽带,改成联通和移动的热点试了下,都不行呀。。
            报错还是这样。这个vps,ip已经被墙,没别的法子利用起来了吗?血亏呀

            2021/03/17 11:14:54 [Warning] [2451679624] 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://amysmith.xyz/tmp): > read tcp 192.168.43.146:11116->162.159.208.4:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 192.168.43.146:11124->162.159.208.4:443: wsarecv: An existing connection was forcibly closed by the remote host. v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 192.168.43.146:11128->162.159.208.4:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > write tcp 192.168.43.146:11145->162.159.208.4:443: i/o timeout v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://amysmith.xyz/tmp): > read tcp 192.168.43.146:11168->162.159.208.4:443: wsarecv: An existing connection was forcibly closed by the remote host.] > v2ray.com/core/common/retry: all retry attempts failed

          3. 你这种情况,必须套cloudflare才能拯救,操作为:1. 没套cloudflare的情况下,伪装网站必须能正常访问(通过走代理方式查看);2. 传输协议必须使用ws; 3. cloudflare的解析页面要开启小黄云;3. 客户端的ip地址填域名或者cloudflare的ip

  10. Job for nginx.service failed because the control process exited with error code.
    See “systemctl status nginx.service” and “journalctl -xe” for details.
    nginx: [emerg] BIO_new_file(“/etc/v2ray/140.82.9.207.pem”) failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(‘/etc/v2ray/140.82.9.207.pem’,’r’) error:2006D080:BIO routines:BIO_new_file:no such file)
    nginx: configuration file /etc/nginx/nginx.conf test failed
    nginx启动失败! 请到 https://hijk.art 反馈
    [root@vultrguest ~]#

  11. 为什么我安装完后出现[Sun Mar 21 14:21:03 CST 2021] Reload error for :
    但是出现了配置成功的界面,但是加密方式是none

发表回复

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