#定义默认,全部错误页面 errors { * default_error.html } # 404 ,500 errors { 404404.html # Not Found 500500.html # Internal Server Error } # 错误记录文件 errors /error.log
重定向
redir 原路径 重定向后路径 #重定向全部到 路径 redir 路径
caddy开机启动配置(centos7+,debian,ubunto):
/etc/systemd/system/caddy.service
[Unit] Description=Caddy HTTP/2 web server Documentation=https://caddyserver.com/docs After=network-online.target Wants=network-online.target systemd-networkd-wait-online.service
[Service] Restart=on-abnormal
; Always set "-root" to something safe in case it gets forgotten in the Caddyfile. ExecStart=/usr/local/bin/caddy -conf=/etc/caddy/Caddyfile ExecReload=/bin/kill -USR1 $MAINPID
; Use graceful shutdown with a reasonable timeout KillMode=mixed KillSignal=SIGQUIT TimeoutStopSec=5s
; Limit the number of file descriptors; see `man systemd.exec` for more limit settings. LimitNOFILE=1048576 ; Unmodified caddy is not expected to use more than that. LimitNPROC=512
; Use private /tmp and /var/tmp, which are discarded after caddy stops. PrivateTmp=true ; Use a minimal /dev PrivateDevices=true ; Hide /home, /root, and /run/user. Nobody will steal your SSH-keys. ProtectHome=true ; Make /usr, /boot, /etc and possibly some more folders read-only. ProtectSystem=full