-
Notifications
You must be signed in to change notification settings - Fork 403
/
1_naive_caddy.json
184 lines (184 loc) · 5.68 KB
/
1_naive_caddy.json
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{
"admin": {
"disabled": true
},
"logging": {
"logs": {
"default": {
"level": "ERROR",
"writer": {
"output": "file",
"filename": "/var/log/caddy/access.log"
}
}
}
},
"apps": {
"layer4": { //加了caddy-l4插件编译的才可启用SNI分流
"servers": {
"sni": {
"listen": [":443"], //443监听端口
"routes": [{
"match": [{
"tls": {
"sni": ["zv.xx.yy"] //更改为自己规划对应vless+tcp+tls的域名
}
}],
"handle": [{
"handler": "proxy",
"upstreams": [{
"dial": ["127.0.0.1:8443"] //转给vless+tcp+tls本地监听端口
}]
}]
},
{
"match": [{
"tls": {
"sni": ["zt.xx.yy"] //更改为自己规划对应trojan+tcp+tls的域名
}
}],
"handle": [{
"handler": "proxy",
"upstreams": [{
"dial": ["127.0.0.1:6443"] //转给trojan+tcp+tls本地监听端口
}]
}]
},
{
"match": [{
"tls": {
"sni": ["zh.xx.yy"] //更改为自己规划对应https server的域名
}
}],
"handle": [{
"handler": "proxy",
"upstreams": [{
"dial": ["127.0.0.1:7443"] //转给https server本地监听端口
}]
}]
}]
}
}
},
"http": {
"servers": {
"h1": {
"listen": [":80"], //http默认监听端口
"routes": [{
"handle": [{
"handler": "static_response",
"status_code": 301,
"headers": {
"Location": ["https://{http.request.host}{http.request.uri}"] //http自动跳转https,让网站看起来更真实。
}
}]
}]
},
"h1h2c": {
"listen": ["127.0.0.1:88"], //http/1.1与h2c server本地监听端口
"routes": [{
"match": [{
"host": ["zv.xx.yy","zt.xx.yy"] //限定域名访问(禁止以ip方式访问网站),更改为自己的对应域名。
}],
"handle": [{
"handler": "headers",
"response": {
"set": {
"Strict-Transport-Security": ["max-age=31536000; includeSubDomains; preload"] //启用HSTS
}
}
},
{
"handler": "file_server",
"root": "/var/www/html" //更改为自己存放的web文件路径
}]
}],
"automatic_https": {
"disable": true //禁用自动https
},
"allow_h2c": true //开启h2c server支持
},
"https": {
"listen": ["127.0.0.1:7443"], //https server本地监听端口
"routes": [{
"match": [{
"path": ["/SeuW56Es"] //与vless+h2c应用中path对应
}],
"handle": [{
"handler": "reverse_proxy",
"transport": {
"protocol": "http",
"versions": ["h2c"]
},
"upstreams": [{
"dial": "127.0.0.1:2005" //转发给本机vless+h2c监听端口
}]
}]
},
{
"match": [{
"path": ["/cdngrpc/*"] //与vless+grpc应用中serviceName对应
}],
"handle": [{
"handler": "reverse_proxy",
"transport": {
"protocol": "http",
"versions": ["h2c"]
},
"upstreams": [{
"dial": "127.0.0.1:2009" //转发给本机vless+grpc监听端口
}],
"flush_interval": -1
}]
},
{
"handle": [{
"handler": "forward_proxy",
"auth_user_deprecated": "user", //naiveproxy用户,更改为自己的。
"auth_pass_deprecated": "pass", //naiveproxy密码,更改为自己的。
"hide_ip": true,
"hide_via": true,
"probe_resistance": {}
}]
},
{
"match": [{
"host": ["zh.xx.yy"] //限定域名访问(禁止以ip方式访问网站),更改为自己的对应域名。
}],
"handle": [{
"handler": "headers",
"response": {
"set": {
"Strict-Transport-Security": ["max-age=31536000; includeSubDomains; preload"] //启用HSTS
}
}
},
{
"handler": "file_server",
"root": "/var/www/html" //更改为自己存放的web文件路径
}]
}],
"tls_connection_policies": [{
"certificate_selection": {
"any_tag": ["tls01"]
},
"cipher_suites": ["TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256"],
"alpn": ["h2","http/1.1"]
}],
"automatic_https": {
"disable": true //禁用自动https
}
}
}
},
"tls": {
"certificates": {
"load_files": [{
"certificate": "/home/tls/zh.xx.yy/zh.xx.yy.crt", //换成自己的证书,绝对路径。
"key": "/home/tls/zh.xx.yy/zh.xx.yy.key", //换成自己的密钥,绝对路径。
"tags": ["tls01"]
}]
}
}
}
}