75 lines
1.4 KiB
Markdown
75 lines
1.4 KiB
Markdown
# Caddy
|
|
|
|
Custom Caddy Builds
|
|
|
|
|
|
Create CLOUDFLARE_API_TOKEN with below permissions.
|
|
* Zone.Zone:Read
|
|
* Zone.DNS:Edit
|
|
|
|
## [Cloudflare ACME](https://github.com/caddy-dns/cloudflare)
|
|
|
|
```Caddyfile
|
|
{
|
|
acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN}
|
|
}
|
|
```
|
|
|
|
## [Dynamic DNS](https://github.com/mholt/caddy-dynamicdns)
|
|
|
|
```Caddyfile
|
|
{
|
|
dynamic_dns {
|
|
provider cloudflare {env.CLOUDFLARE_API_TOKEN}
|
|
domains {
|
|
example.com
|
|
}
|
|
versions ipv4
|
|
}
|
|
}
|
|
```
|
|
|
|
## [CrowdSec](https://github.com/hslatman/caddy-crowdsec-bouncer)
|
|
|
|
```Caddyfile
|
|
{
|
|
crowdsec {
|
|
api_url http://crowdsec:8080
|
|
api_key {$CROWDSEC_API_KEY}
|
|
ticker_interval 3s
|
|
appsec_url http://crowdsec:7422
|
|
#disable_streaming
|
|
#enable_hard_fails
|
|
}
|
|
}
|
|
|
|
#Add Logging to Caddy
|
|
(logging) {
|
|
log {
|
|
output file /logs/access.log {
|
|
roll_size 10MB # Create new file when size exceeds 10MB
|
|
roll_keep 5 # Keep at most 5 rolled files
|
|
roll_keep_for 168h # Delete files older than 14 days
|
|
roll_uncompressed
|
|
}
|
|
}
|
|
}
|
|
|
|
ryuu.in www.ryuu.in {
|
|
route {
|
|
crowdsec
|
|
}
|
|
redir https://git.ryuu.in/ryuupendragon permanent
|
|
import logging
|
|
}
|
|
|
|
example.ryuu.in {
|
|
route {
|
|
crowdsec
|
|
}
|
|
reverse_proxy ip:port
|
|
import logging
|
|
}
|
|
|
|
```
|