caddy1服务启动报错问题
纯粹口水一下caddy1遇上的启动报错问题.
报错内容如下
Process: 472999 ExecStart=/usr/bin/caddy -conf /etc/caddy/caddy.conf -root /tmp -agree (code=exited, status=1/FAILURE)
Main PID: 472999 (code=exited, status=1/FAILURE)
CPU: 26ms
Aug 12 11:48:36 klayer systemd[1]: Starting Caddy HTTP/2 web server...
Aug 12 11:48:36 klayer caddy[472992]: Caddyfile is valid
Aug 12 11:48:36 klayer systemd[1]: Started Caddy HTTP/2 web server.
Aug 12 11:48:36 klayer caddy[472999]: Activating privacy features... 2023/08/12 11:48:36 failed storage check: open /var/lib/caddy/rw_test_1203782840230465039>
Aug 12 11:48:36 klayer systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Aug 12 11:48:36 klayer systemd[1]: caddy.service: Failed with result 'exit-code'.
解决如下
ulimit -n 8192
cat>>/etc/security/limits.conf<<EOF
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
root soft nofile 65535
root hard nofile 65535
root soft nproc 65535
root hard nproc 65535
EOF
useradd -M caddy -s /sbin/nologin
mkdir /var/lib/caddy
chown caddy.caddy /var/lib/caddy
一个是limits系统参数问题,一个/var/lib/caddy目录问题, 如果caddy用户给root权限就没第二个问题.