Caddy with forward proxy
4.2K
Pull the image
docker pull jonssonyan/caddy-forwardproxy
Start a container
在运行之前必须创建/caddy-forwardproxy/config/config.json
mkdir -p /caddy-forwardproxy/config
配置示例:
{
"admin": {
"disabled": true
},
"logging": {
"sink": {
"writer": {
"output": "discard"
}
},
"logs": {
"default": {
"writer": {
"output": "discard"
}
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":${your_port}"
],
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"auth_pass_deprecated": "${your_password}",
"auth_user_deprecated": "${your_username}",
"handler": "forward_proxy",
"hide_ip": true,
"hide_via": true,
"probe_resistance": {}
}
]
},
{
"match": [
{
"host": [
"${your_domain}"
]
}
],
"handle": [
{
"handler": "file_server",
"root": "/caddy-forwardproxy/dist/",
"index_names": [
"index.html",
"index.htm"
]
}
],
"terminal": true
}
]
}
]
}
],
"tls_connection_policies": [
{
"match": {
"sni": [
"${your_domain}"
]
}
}
],
"automatic_https": {
"disable": true
}
}
}
},
"tls": {
"certificates": {
"load_files": [
{
"certificate": "${crt_path}",
"key": "${key_path}"
}
]
}
}
}
}
参数解释:
${your_port}:Caddy服务端口${your_password}:认证的密码${your_username}:认证的用户名${your_domain}:你的域名${crt_path}:自定义证书.crt文件路径${key_path}:自定义证书.key文件路径通过以下命令启动容器:
docker run -d --name caddy-forwardproxy --restart always --network=host -v /caddy-forwardproxy/config/:/caddy-forwardproxy/config/ jonssonyan/caddy-forwardproxy
参数解释:
--name caddy-forwardproxy:定义容器名称--restart always:容器随着Docker启动而启动--network=host:使用Host网络模式-v /caddy-forwardproxy/config/:/caddy-forwardproxy/config/:映射Caddy配置文件夹注意:如果证书文件不在/caddy-forwardproxy/config/,则在启动容器是需要挂载对应目录。
Content type
Image
Digest
sha256:8e6311f72…
Size
21.1 MB
Last updated
over 3 years ago
docker pull jonssonyan/caddy-forwardproxy