V2ray with Caddy + HTTP2 + TLS
2022-8-8 21:47:48 Author: taxodium.ink(查看原文) 阅读量:5 收藏

周末时翻到一篇关于 HTTP2 的搭建,有一个网站比较了 HTTP/1.1 和 HTTP2 的 加载速度,发现 HTTP2 是真的很快,就想着重新部署一个代理,看是否有更好 的体验。

之前搭建 WebSocket + TLS + Web 的时候是用的 Nginx,为了实现 TLS,需 要去 Let's Encrypt 申请证书,这篇教程里有介绍怎么申请。

搭建代理不需要很高的配置,买一个最低配置的 VPS 即可,考虑到 CentOS 不再维护,我安装的是 Ubuntu,总之找一个自己熟悉的 linux 操作系统即 可。

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
  {
    "log": {
      "loglevel": "warning"
    },
    "inbounds": [
      {
      "port": <v2ray-port>,
      "listen": "127.0.0.1",
      "tag": "vmess-inbound",
      "protocol": "vmess",
      "settings": {
        "auth": "noauth",
        "udp": false,
        "ip": "127.0.0.1",
        "clients": [
          {
          "id": "<uuid>",
          "level": 0,
          "alterId": 0,
        },
        ]
      },
      "streamSettings": {
        "network": "h2",
        "security": "none",
        "httpSettings": {
          "path": "<http2-path>",
          "host": ["<domain>"]
        },
        "tlsSettings": {
          "serverName": "<domain>"
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      }
    }
    ],
    "outbounds": [
      {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    },
      {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
    ],
    "routing": {
      "domainStrategy": "IPOnDemand",
      "rules": [
        {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      },
        {
        "type": "field",
        "domain": ["geosite:category-ads"],
        "outboundTag": "blocked"
      }
      ]
    },
    "dns": {
      "hosts": {
        "domain:v2ray.com": "www.vicemc.net",
        "domain:github.io": "pages.github.com",
        "domain:wikipedia.org": "www.wikimedia.org",
        "domain:shadowsocks.org": "electronicsrealm.com"
      },
      "servers": [
        "1.1.1.1",
        {
          "address": "114.114.114.114",
          "port": 53,
          "domains": ["geosite:cn"]
        },
        "8.8.8.8",
        "localhost"
      ]
    },
    "policy": {
      "levels": {
        "0": {
          "uplinkOnly": 0,
          "downlinkOnly": 0,
          "bufferSize": 204800,
          "handshake": 10
        }
      },
      "system": {
        "statsInboundUplink": false,
        "statsInboundDownlink": false,
        "statsOutboundUplink": false,
        "statsOutboundDownlink": false
      }
    }
  }

文章来源: https://taxodium.ink/post/v2ray-caddy-http2-tls/
如有侵权请联系:admin#unsafe.sh