Skip to content

Instantly share code, notes, and snippets.

@hang333
Last active July 17, 2022 19:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save hang333/047ecf4c8d7d2868f1ce142d713a3520 to your computer and use it in GitHub Desktop.
Save hang333/047ecf4c8d7d2868f1ce142d713a3520 to your computer and use it in GitHub Desktop.
domain
# Set this path to your site's directory.
#root * /usr/share/caddy
root * /var/www/domain
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
#php_fastcgi unix//run/php/php7.4-fpm.sock
#encode gzip
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
tls {
dns cloudflare <cloudflare_api_here>
}
@v2ray_websocket {
path /wspath
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy @v2ray_websocket localhost:wsport
reverse_proxy /h2path http://localhost:h2port {
#header_up Host {http.request.host}
#header_up X-Real-IP {http.request.remote.host}
#header_up X-Forwarded-For {http.request.remote.host}
#header_up X-Forwarded-Port {http.request.port}
#header_up X-Forwarded-Proto {http.request.scheme}
transport http {
#tls
#tls_insecure_skip_verify
versions h2c 2
}
}
V2Ray 4.26.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.14.4 windows/amd64)
A unified platform for anti-censorship.
2020/07/28 20:51:43 Using default config: <censored>\v2ray\config.json
2020/07/28 20:51:43 [Info] v2ray.com/core/common/platform/ctlcmd: <v2ctl message>
v2ctl> Read config: <censored>\v2ray\config.json
2020/07/28 20:51:44 [Warning] v2ray.com/core: V2Ray 4.26.0 started
2020/07/28 20:51:46 tcp:127.0.0.1:4375 accepted tcp:ip.sb:443 [Proxy]
2020/07/28 20:51:47 tcp:127.0.0.1:4377 accepted tcp:push.services.mozilla.com:443 [Proxy]
2020/07/28 20:51:47 [Warning] [432679854] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: failed to read response header > EOF
2020/07/28 20:51:47 [Warning] [2050222500] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: failed to read response header > EOF
{
"log": {
"loglevel": "warning"
},
"dns": {
"hosts": {
"dns.google": "8.8.8.8"
},
"servers": [
{
"address": "https://1.1.1.1/dns-query",
"domains": [
"geosite:geolocation-!cn"
]
},
"https://1.1.1.1/dns-query",
"https://dns.google/dns-query",
{
"address": "114.114.114.114",
"port": 53,
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
]
}
]
},
"inbounds": [
{
"protocol": "socks",
"listen": "127.0.0.1",
"port": 1080,
"tag": "Socks-In",
"settings": {
"ip": "127.0.0.1",
"udp": true,
"auth": "noauth"
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{
"protocol": "http",
"listen": "127.0.0.1",
"port": 2080,
"tag": "Http-In",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "domain",
"port": 443,
"users": [
{
"id": "h2_id",
"alterId": 64
}
]
}
]
},
"streamSettings": {
"network": "h2",
"httpSettings": {
"path": "/h2path"
},
"security": "tls"
},
"tag": "Proxy"
},
{
"protocol": "dns",
"tag": "Dns-Out"
},
{
"protocol": "freedom",
"tag": "Direct",
"settings": {
"domainStrategy": "UseIPv4"
}
},
{
"protocol": "blackhole",
"tag": "Reject",
"settings": {
"response": {
"type": "http"
}
}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"outboundTag": "Direct",
"protocol": [
"bittorrent"
]
},
{
"type": "field",
"outboundTag": "Dns-Out",
"inboundTag": [
"Socks-In",
"Http-In"
],
"network": "udp",
"port": 53
},
{
"type": "field",
"outboundTag": "Direct",
"domain": [
"geosite:tld-cn",
"geosite:apple-cn",
"geosite:google-cn",
"geosite:tld-cn",
"domain:icloud.com",
"domain:icloud-content.com"
]
},
{
"type": "field",
"outboundTag": "Proxy",
"domain": [
"geosite:geolocation-!cn"
]
},
{
"type": "field",
"outboundTag": "Direct",
"domain": [
"geosite:cn"
]
},
{
"type": "field",
"outboundTag": "Direct",
"ip": [
"223.5.5.5/32",
"119.29.29.29/32",
"180.76.76.76/32",
"114.114.114.114/32"
]
},
{
"type": "field",
"outboundTag": "Proxy",
"ip": [
"1.1.1.1/32",
"1.0.0.1/32",
"8.8.8.8/32",
"8.8.4.4/32"
]
},
{
"type": "field",
"outboundTag": "Direct",
"ip": [
"geoip:cn",
"geoip:private"
]
},
{
"type": "field",
"outboundTag": "Proxy",
"network": "tcp,udp"
}
]
}
}
{
"log": {
"loglevel": "warning",
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log"
},
"inbounds": [
{
"port": "wsport",
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "ws_id",
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/wspath"
}
}
},
{
"port": "h2port",
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "h2_id",
"alterId": 64
}
]
},
"streamSettings": {
"network": "h2",
"security": "none",
"httpSettings": {
"path": "/h2path",
"host": [
"domain"
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment