1. Caddy version (caddy version
):
2.3.0
2. How I run Caddy:
a. System environment:
#root@miscx:/# which caddy
/usr/bin/caddy
#root@miscx:/# whereis caddy
caddy: /usr/bin/caddy /etc/caddy /usr/share/caddy
#root@miscx:/etc/default# uname -a
Linux miscx 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
#root@miscx:/# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
b. Command:
#directly
caddy reverse-proxy --from caddy-test.duckdns.org --to 127.0.0.1:8096
#via systemctl
sudo systemctl daemon-reload && sudo systemctl start caddy.service
c. Service/unit/compose file:
root@miscx:/# cat /etc/systemd/system/caddy.service
[Unit]
Description=Caddy web server
After=network-online.target
[Service]
User=caddy
Group=caddy
Type=exec
ExecStart=/usr/bin/caddy run -config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload -config /etc/caddy/Caddyfile
ExecStop=/usr/bin/caddy stop
#Restart=always
RestartSec=15
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
PrivateDevices=true
ProtectHome=true
ProtectSystem=strict
ReadWritePaths=/etc/caddy/.local /etc/caddy/.config /var/log
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
{
email myemail@gmail.com
}
caddy-test.duckdns.org {
reverse_proxy 127.0.0.1:8096
# reverse_proxy 157.xx.xxx.xx:8096
}
3. The problem I’m having:
After installing caddy, and setting up caddy.service
and Caddyfile
as above, I ran sudo systemctl daemon-reload && sudo systemctl start caddy.service
.
I am not able to access the app through the domain caddy-test.duckdns.org
. I am getting “ERR_EMPTY_RESPONSE”. Is this something on duckdns side or something in my caddy setup?
4. Error messages and/or full log output:
#root@miscx:/# sudo systemctl status caddy
â—Ź caddy.service - Caddy web server
Loaded: loaded (/etc/systemd/system/caddy.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2021-02-12 21:48:51 CET; 10s ago
Main PID: 3517 (caddy)
Tasks: 7 (limit: 4567)
Memory: 10.2M
CGroup: /system.slice/caddy.service
└─3517 /usr/bin/caddy run -config /etc/caddy/Caddyfile
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3304942,"logger":"admin","msg":"admin endpoint st>
Feb 12 21:48:51 miscx caddy[3517]: {"level":"error","ts":1613162931.3309324,"logger":"tls","msg":"migrating certific>
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3310163,"logger":"http","msg":"server is listenin>
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.331077,"logger":"http","msg":"enabling automatic >
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3317883,"logger":"http","msg":"enabling automatic>
Feb 12 21:48:51 miscx caddy[3517]: {"level":"error","ts":1613162931.3321085,"msg":"unable to autosave config","file">
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3321378,"msg":"serving initial configuration"}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3331678,"logger":"tls","msg":"cleaned up storage >
Feb 12 21:48:51 miscx caddy[3517]: {"level":"error","ts":1613162931.3332756,"logger":"tls","msg":"job failed","error>
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3335195,"logger":"tls.cache.maintenance","msg":"s>
#root@miscx:/# journalctl -xef -u caddy.service
Feb 12 21:48:51 miscx systemd[1]: Starting Caddy web server...
-- Subject: A start job for unit caddy.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit caddy.service has begun execution.
--
-- The job identifier is 1146.
Feb 12 21:48:51 miscx systemd[1]: Started Caddy web server.
-- Subject: A start job for unit caddy.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit caddy.service has finished successfully.
--
-- The job identifier is 1146.
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.32768,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3304942,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"error","ts":1613162931.3309324,"logger":"tls","msg":"migrating certificates","error":"making new certs directory: mkdir /var/lib/caddy/.local/share/caddy/certificates/acme-staging-v02.api.letsencrypt.org-directory: read-only file system"}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3310163,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.331077,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3317883,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["caddy-test.duckdns.org"]}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"error","ts":1613162931.3321085,"msg":"unable to autosave config","file":"/var/lib/caddy/.config/caddy/autosave.json","error":"open /var/lib/caddy/.config/caddy/autosave.json: read-only file system"}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3321378,"msg":"serving initial configuration"}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3331678,"logger":"tls","msg":"cleaned up storage units"}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"error","ts":1613162931.3332756,"logger":"tls","msg":"job failed","error":"caddy-test.duckdns.org: obtaining certificate: failed storage check: open /var/lib/caddy/.local/share/caddy/rw_test_6846998850455003241: read-only file system - storage is probably misconfigured"}
Feb 12 21:48:51 miscx caddy[3517]: {"level":"info","ts":1613162931.3335195,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0002d5180"}
Note: This setup is on a hetzner server and I can access the app at 157.xx.xxx.xx:8096
Also, is there a way to fully remove caddy and all related files for a fresh start?