问题描述
我正在使用 systemd 在 ubuntu 16.04 机器上启动一个 caddy 网络服务器.每当我运行 sudo service caddy start
和 service caddy status
时,我都会收到此错误:
I'm using systemd to start a caddy webserver on an ubuntu 16.04 machine. Whenever I run sudo service caddy start
and service caddy status
, I get this error:
● caddy.service - Caddy webserver
Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2016-08-29 05:03:02 EDT; 4s ago
Docs: https://caddyserver.com/
Process: 1135 ExecStart=/usr/local/bin/caddy -agree -email me@example -pidfile=/var/run/caddy/caddy.pid (code=exited, status
Main PID: 1135 (code=exited, status=1/FAILURE)
systemd[1]: Started Caddy webserver.
caddy[1135]: Activating privacy features... done.
caddy[1135]: 2016/08/29 05:03:02 Caddyfile:12 - Parse error: unknown property 'errors'
systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: caddy.service: Unit entered failed state.
systemd[1]: caddy.service: Failed with result 'exit-code'.
推荐答案
在我的 /etc/systemd/system/caddy.service
文件中,我有以下一行:
In my /etc/systemd/system/caddy.service
file, I had the following line:
Restart=on-failure
注释掉(使用 #
或 ;
)并重新启动服务显示了潜在的问题,它在我的 Caddyfile 中.
Commenting that out (with #
or ;
) and restarting the service showed the underlying problem, which was in my Caddyfile.
service caddy status
只打印日志中的几行,因此有时您只需查看完整日志即可找到根本问题.如果使用 syslog,这是通过以下方式完成的:
service caddy status
only prints a few lines from the log, so sometimes you can find the underlying problem by simply looking at the full log. If using syslog, this is done with:
journalctl -u caddy
这篇关于caddy.service 启动请求重复得太快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!