662 / issue-blog

Blog
MIT License
1 stars 0 forks source link

拐弯抹角使用Google搜索技术资料 #6

Open 662 opened 6 years ago

662 commented 6 years ago

自家用潦草笔记,只列大纲,不列过程。

目标: WebSocket+TLS -> nginx -> V2Ray

所需物资:

安装

V2Ray

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

Nginx

直接用官方Packages安装

acme.sh

参照中文文档,4步搞定:安装acme.sh -> 生成证书 -> 安装证书 -> 配置自更新

配置

V2Ray

{
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 11111,    // 监听的端口
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "",   // uuid
            "alterId": 64
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path": "/path"   // websocket 地址
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}

Nginx

server {
    listen  443 ssl;
    ssl_certificate        your.cer.path;     # 证书 .cer 路径
    ssl_certificate_key    your.key.path;     # 证书 .key 路径 
    ssl_protocols         TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers           HIGH:!aNULL:!MD5;
    server_name  yourdomain;    # 域名

    root your-web-root;

    location /yourpath {    # websocket 地址
        proxy_redirect off;
        proxy_pass http://127.0.0.1:your-port;  # 监听的端口
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
662 commented 6 years ago

留言测试。

662 commented 6 years ago

留言测试。