1 2 3 4 5 6 7 8 9 10 11 12 13
| mv caddy /usr/bin/
caddy version
groupadd --system caddy
useradd --system \ --gid caddy \ --create-home \ --home-dir /var/lib/caddy \ --shell /usr/sbin/nologin \ --comment "Caddy web server" \ caddy
|
/etc/systemd/system/caddy.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| [Unit] Description=caddy
[Service]
WorkingDirectory=/opt/caddy PrivateTmp=true Restart=always Type=simple
ExecStart=caddy run --environ --config /opt/caddy/Caddyfile ExecReload=caddy reload --config /opt/caddy/Caddyfile
ExecStop=/usr/bin/kill -15 $MAINPID
[Install] WantedBy=multi-user.target
|
/opt/caddy/Caddyfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| { admin off servers :443 { protocols h1 h2 h3 } }
:443, www.geektang.cn tls xxxxxfff@gmail.com route { reverse_proxy 127.0.0.1:8000 { header_up Host {upstream_hostport} header_up X-Forwarded-Host {host} } }
|