-
Notifications
You must be signed in to change notification settings - Fork 89
/
caddy.sh
executable file
·26 lines (21 loc) · 1.23 KB
/
caddy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
set -eux
fail () { echo $1 >&2; exit 1; }
[[ $(id -u) = 0 ]] || fail "Please run 'sudo $0'"
# To custom compile dns providers, include e.g.:
# --with github.com/caddy-dns/azure --with github.com/caddy-dns/cloudflare --with github.com/caddy-dns/digitalocean --with github.com/caddy-dns/gandi --with github.com/caddy-dns/godaddy --with github.com/caddy-dns/googleclouddns --with github.com/caddy-dns/hetzner --with github.com/caddy-dns/linode --with github.com/caddy-dns/namecheap --with github.com/caddy-dns/netlify --with github.com/caddy-dns/ovh --with github.com/caddy-dns/powerdns --with github.com/caddy-dns/rfc2136 --with github.com/caddy-dns/route53 --with github.com/caddy-dns/vercel --with github.com/caddy-dns/vultr
wget -qO- https://caddy.fast.ai | bash
mv caddy /usr/bin/
wget -q https://raw.githubusercontent.com/caddyserver/dist/refs/heads/master/init/caddy.service
mv caddy.service /etc/systemd/system/
groupadd --system caddy
useradd --system --gid caddy --create-home --home-dir /var/lib/caddy --shell /usr/sbin/nologin caddy
mkdir -p /etc/caddy
cat >> /etc/caddy/Caddyfile <<EOF
localhost
respond "Hello, world!"
EOF
chown -R caddy:caddy /etc/caddy
systemctl daemon-reload
systemctl enable caddy
systemctl start caddy