master
Kar l5 2024-04-27 21:37:34 +05:30
parent 9797b0c513
commit b2e7987dc0
3 changed files with 178 additions and 0 deletions

30
caddy/Caddyfile Normal file
View File

@ -0,0 +1,30 @@
http://code.internal:8080 {
# Could be another domain/IP as well
reverse_proxy {
to localhost:8081
}
}
http://stage.internal:8080 {
# Could be another domain/IP as well
reverse_proxy 127.0.0.1:8082
}
http://dev.internal:8080 {
# Proxy with a DNS Server name instead
reverse_proxy internal-site:8083
}
test.domains.siliconpin.com {
# Could be another domain/IP as well
reverse_proxy :9002
}
http://web.internal:8080 {
handle /code/* {
# Could be another domain/IP as well
reverse_proxy {
to localhost:8081
}
}
}

145
caddy/config-sample.json Normal file
View File

@ -0,0 +1,145 @@
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": ":9002"
}
]
}
]
}
]
}
],
"match": [
{
"host": [
"ns61.siliconpin.com"
]
}
],
"terminal": true
}
]
},
"srv1": {
"automatic_https": {
"skip": [
"stage.internal",
"code.internal",
"dev.internal"
]
},
"listen": [
":8080"
],
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "127.0.0.1:8082"
}
]
}
]
}
]
}
],
"match": [
{
"host": [
"stage.internal"
]
}
],
"terminal": true
},
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "localhost:8081"
}
]
}
]
}
]
}
],
"match": [
{
"host": [
"code.internal"
]
}
],
"terminal": true
},
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "internal-site:8083"
}
]
}
]
}
]
}
],
"match": [
{
"host": [
"dev.internal"
]
}
],
"terminal": true
}
]
}
}
}
}
}

3
caddy/run.txt Normal file
View File

@ -0,0 +1,3 @@
docker run -itd --name caddy --net host --restart unless-stopped -v ~/docker/data/caddy/Caddyfile:/etc/caddy/Caddyfile -v ~/docker/data/caddy/srv:/srv -v ~/docker/data/caddy/caddy_data:/data -v ~/docker/data/caddy/caddy_config:/config caddy
curl "http://localhost:2019/config/" | jq