forked from lxhao61/integrated-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_naive_caddy.json
71 lines (71 loc) · 2.05 KB
/
3_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
{
"admin": {
"disabled": true
},
"logging": {
"logs": {
"default": {
"level": "ERROR",
"writer": {
"output": "file",
"filename": "/var/log/caddy/access.log"
}
}
}
},
"apps": {
"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": ["unix//dev/shm/h1h2c.sock"], //http/1.1与h2c server监听进程
"listener_wrappers": [{
"wrapper": "proxy_protocol" //开启PROXY protocol接收
}],
"routes": [{
"handle": [{
"handler": "forward_proxy",
"auth_user_deprecated": "user", //naiveproxy用户,更改为自己的。
"auth_pass_deprecated": "pass", //naiveproxy密码,更改为自己的。
"hide_ip": true,
"hide_via": true,
"probe_resistance": {}
}]
},
{
"match": [{
"host": ["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支持
}
}
}
}
}