1. The problem I’m having:
I am trying to get a simple response through my browser.
I had my rpi4 and Caddy running as a NAS about 4 years ago. After a house move I disconnected it and finally just got everything hooked back up. 4 years later I’ve forgotten quite a bit. I was trying to get it running using my previous Caddyfile but was having some issues. I’m sure the issues were due to new router, ip address, using DuckDNS, along with other things. So I went ahead and am now just running a simple Caddyfile with “Hello, World!” and unable to get a web browser to give me a response. I do however get “Hello, World!” printed out by using the curl https://localhost
command.
I don’t know if the issue is in my router, security keys, configfile, or else where. I do plan to update both the Debian version and Caddy but first want to just remember how to get this working again.
2. Error messages and/or full log output:
From my web browser…
localhost refused to connect.
3. Caddy version:
v2.4.3
4. How I installed and ran Caddy:
a. System environment:
Raspberry Pi 4
PRETTY_NAME=“Raspbian GNU/Linux 10 (buster)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“10”
VERSION=“10 (buster)”
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL=“http://www.raspbian.org/”
SUPPORT_URL=“RaspbianForums - Raspbian”
BUG_REPORT_URL=“RaspbianBugs - Raspbian”
b. Command:
sudo caddy start --config /srv/dev-disk-by-label-Ho meDrive/HomeDrive/"config files"/Caddy2/Caddyfile
2024/07/13 16:33:33.029 INFO using provided configuration {"config_file": "/srv/dev-disk-by-label-HomeDrive/HomeDrive/config files/Caddy2/Caddyfile", "con fig_adapter": ""}
2024/07/13 16:33:33.031 WARN input is not formatted with 'caddy fmt' {"adapte r": "caddyfile", "file": "/srv/dev-disk-by-label-HomeDrive/HomeDrive/config file s/Caddy2/Caddyfile", "line": 3}
2024/07/13 16:33:33.034 INFO admin admin endpoint started {"address": "tcp /localhost:2019", "enforce_origin": false, "origins": ["[::1]:2019", "127.0.0.1: 2019", "localhost:2019"]}
2024/07/13 16:33:33.035 INFO http server is listening only on the HTTPS po rt but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2024/07/13 16:33:33.035 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2024/07/13 16:33:33.035 INFO tls.cache.maintenance started background certi ficate maintenance {"cache": "0x362f770"}
2024/07/13 16:33:33.041 INFO tls cleaning storage unit {"description": "FileStorage:/root/.local/share/caddy"}
2024/07/13 16:33:33.047 INFO tls finished cleaning storage units
2024/07/13 16:33:33.137 INFO pki.ca.local root certificate is already trus ted by system {"path": "storage:pki/authorities/local/root.crt"}
2024/07/13 16:33:33.138 INFO http enabling automatic TLS certificate manag ement {"domains": ["localhost"]}
2024/07/13 16:33:33.140 WARN tls stapling OCSP {"error": "no OCSP stapl ing for [localhost]: no OCSP server specified in certificate"}
2024/07/13 16:33:33.141 INFO autosaved config (load with --resume flag) { "file": "/root/.config/caddy/autosave.json"}
2024/07/13 16:33:33.141 INFO serving initial configuration
Successfully started Caddy (pid=15611) - Caddy is running in the background
c. Service/unit/compose file:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
d. My complete Caddy config:
localhost
respond "Hello, world!"