For XXFor XX

作为一个高手
我习惯了孤独

v2ray搭建及配置教程

v2ray搭建及配置教程

PJ_EN-AU10859560585_1920x1080.jpg

官网:https://www.v2ray.com

服务端搭建脚本

Linux一键脚本:

bash <(curl -L -s https://install.direct/go.sh)

Windows 等其他搭建教程见官网
https://www.v2ray.com/chapter_00/install.html

配置文件

目录:/etc/v2ray/config.json

我的配置文件

{
  "log": {
      "access": "/var/log/v2ray/access.log",
      "error": "/var/log/v2ray/error.log",
      "loglevel": "warning"
  },
  "inbound": {
      "port": 80,
      "protocol": "vmess",
      "settings": {
          "clients": [
              {
                  "id": "a641f8a8-470b-8805-903d-fe5840481cb5",
                  "level": 1,
                  "email": "http@4xx.me",
                  "alterId": 64
              }
          ]
      },
      "streamSettings": {
        "network": "tcp",
        "httpSettings": { 
            "path": "/http"
        },
        "tcpSettings": {
            "header": { 
              "type": "http",
              "response": {
                "version": "1.1",
                "status": "200",
                "reason": "OK",
                "headers": {
                  "Content-Type": ["application/octet-stream", "application/x-msdownload", "text/html", "application/x-shockwave-flash"],
                  "Transfer-Encoding": ["chunked"],
                  "Connection": ["keep-alive"],
                  "Pragma": "no-cache"
                }
              }
            }
        }
      }
  },
  "outbound": {
      "protocol": "freedom",
      "settings": {}
  },
  "inboundDetour": [
      {
          "port": 10000,
          "listen":"127.0.0.1",
          "protocol": "vmess",
          "settings": {
              "clients": [
                  {
                      "id": "ed827005-d9cc-dfe2-161a-2e0b0f0b077a",
                      "level": 1,
                      "email": "https@4xx.me",
                      "alterId": 64
                  }
              ]
          },
          "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/https"
                }
            }
      }
  ],
  "outboundDetour": [
      {
          "protocol": "blackhole",
          "settings": {},
          "tag": "blocked"
      }
  ],
  "routing": {
      "strategy": "rules",
      "settings": {
          "rules": [
              {
                  "type": "field",
                  "ip": [
                      "0.0.0.0/8",
                      "10.0.0.0/8",
                      "100.64.0.0/10",
                      "127.0.0.0/8",
                      "169.254.0.0/16",
                      "172.16.0.0/12",
                      "192.0.0.0/24",
                      "192.0.2.0/24",
                      "192.168.0.0/16",
                      "198.18.0.0/15",
                      "198.51.100.0/24",
                      "203.0.113.0/24",
                      "::1/128",
                      "fc00::/7",
                      "fe80::/10"
                  ],
                  "outboundTag": "blocked"
              }
          ]
      }
  }
}

该配置文件分配了2个用户,并分配了2种模式
80端口为http伪装,可伪装host,手机端可用来免流
10000端口为WebSocket模式,配合nginx+https,因为是标准https请求,所以可实现nginx负载、cdn加速(我测试的cdn只要cloudflare成功了,360、阿里全站加速都不成功,不知道什么原因)

WebSocket+TLS+Web说明:https://toutyrater.github.io/advanced/wss_and_web.html
nginx配置:
我用的tengine,和nginx配置一样的,如果要使用ipv6,编译的时候要加上--with-ipv6

 server {

    listen 443 ssl;
    listen [::]:443 ssl;
    ssl_certificate /usr/local/tengine/conf/ssl/tls.crt;       #ssl证书路径
    ssl_certificate_key /usr/local/tengine/conf/ssl/tls.key;
    ssl_protocols         TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_timeout 10m;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_buffer_size 1400;
    add_header Strict-Transport-Security max-age=15768000;
    ssl_stapling on;
    ssl_stapling_verify on;
    access_log /data/wwwlogs/nginx.log combined;

    index index.html;
    root /data/wwwroot/default;

    location /https {
        proxy_redirect off;
        proxy_pass http://127.0.0.1:10000;#假设WebSocket监听在环回地址的10000端口上
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        }

    }

客户端下载

https://www.v2ray.com/ui_client/

Windows端 推荐使用 V2RayN
V2RayN:https://github.com/2dust/v2rayN/releases
v2ray核心文件:https://github.com/v2ray/v2ray-core/releases
需要先现在v2ray核心文件,再下载V2RayN,将V2RayN.exe放到v2ray核心文件目录,启动V2RayN.exe即可

安卓端 推荐使用 BifrostV
BifrostV谷歌商店:https://play.google.com/store/apps/details?id=com.github.dawndiy.bifrostv
BifrostV 0.5.6:https://pan.baidu.com/s/1GcItH3qerjwoq1hLJ3rnyQ 密码: yzxc

客户端配置截图

Windows端
10000端口配合nginx+TLS
QQ截图20180610151053.png

80端口http伪装
QQ截图20180610151120.png

安卓端
80端口http伪装
Screenshot_2018-06-10-15-14-08-709_com.github.daw_看图王.png

http伪装参数,送大家个爱奇艺免流host,只要爱奇艺流量免费,这个host产生的流量就不计费
Screenshot_2018-06-10-15-20-12-737_com.github.daw.png

想用详细了解的请去官网浏览:https://www.v2ray.com

转载请注明出处:For XX » v2ray搭建及配置教程
标签:没有标签
分享到: 更多