Skip to content

Instantly share code, notes, and snippets.

@lxgr
Created April 26, 2022 21:09
Show Gist options
  • Save lxgr/303b1a3cd87005edb43b91545c5306ba to your computer and use it in GitHub Desktop.
Save lxgr/303b1a3cd87005edb43b91545c5306ba to your computer and use it in GitHub Desktop.
Caddy example setup
# *.home.mydomain.name is configured as a catchall CNAME in my DNS provider to point to the Caddy box.
# That way, everything needed to add a new subdomain/service is adding it in this file and reloading Caddy.
...
project-1.home.mydomain.name {
respond "This will be provided as a static HTTP response"
}
project-2.home.mydomain.name {
# HTTP basic authentication. Static hosted content served directly by Caddy.
root * /home/web/project2/root
file_server
basicauth * {
foo SomeBase64Secret
}
}
nas.home.mydomain.name {
# Proxying to a local network HTTP service (a Synology Diskstation). Caddy will be terminating TLS.
reverse_proxy synology.local:5000
}
project-3.home.mydomain.name {
# Proxying to a locally running HTTP service. Caddy will be terminating TLS.
reverse_proxy localhost:8123
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment