Skip to content

Instantly share code, notes, and snippets.

@zeromancer
Created May 17, 2018 19:34
Show Gist options
  • Save zeromancer/fdc3ce571ac73c47abcc65338b8613bc to your computer and use it in GitHub Desktop.
Save zeromancer/fdc3ce571ac73c47abcc65338b8613bc to your computer and use it in GitHub Desktop.
unused caddy + docker config
# Caddy - Configuration
touch /var/log/caddy.log
chown http /var/log/caddy*
mkdir -p /opt/caddy/ssl
cat >/opt/caddy/Caddyfile <<EOF
https://$SERVER_NAME.$DOMAIN:4443 {
root /srv
log /var/log/caddy.log
gzip
}
https://$SERVER_NAME-nextcloud.$DOMAIN:4443 {
proxy / localhost:8080 {
transparent
}
log /var/log/caddy-nextloud.log
gzip
}
https://$SERVER_NAME-portainer.$DOMAIN:4443 {
proxy / localhost:9000 {
transparent
}
log /var/log/caddy-portainer.log
gzip
}
https://$SERVER_NAME-resilio.$DOMAIN:4443 {
proxy / localhost:9002 {
transparent
}
log /var/log/caddy-resilio.log
gzip
}
EOF
chown -R http /opt/caddy
mkdir -p /opt/data/website
echo '<!doctype html><meta charset=utf-8><title>Welcome to '"$SERVER_NAME"'.'"$DOMAIN"'</title>' >/opt/data/website/index.html
chown -R http /opt/data
# https://hub.docker.com/r/abiosoft/caddy/
docker build --build-arg \
plugins=filemanager,git,webdav,jekyll,hugo \
github.com/abiosoft/caddy-docker.git \
--label mycaddy
mkdir -p /opt/caddy/certs
# Caddy
docker run -d --rm \
--name caddy \
--user $USER_ID \
-v /opt/caddy/Caddyfile:/etc/Caddyfile \
-e "ACME_AGREE=true" \
-e "CADDYPATH=/etc/caddycerts" \
-v /opt/caddy/certs:/etc/caddycerts \
-v /opt/data/website:/srv \
-p 80:80 -p 4443:443 \
abiosoft/caddy:no-stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment