1. Caddy version (caddy version
):
v2.1.1 h1:X9k
2. How I run Caddy:
a. System environment:
Debian 9
b. Command:
sudo apt install caddy -y
d. My complete Caddyfile or JSON config:
domainname1.com {
tls hb@domainname1.com
reverse_proxy 127.0.0.1:3000 {
header_up Host {http.request.host}
header_up X-Real-IP {http.request.remote}
header_up X-Forwarded-For {http.request.remote}
header_up X-Forwarded-Port {http.request.port}
header_up X-Forwarded-Proto {http.request.scheme}
}
}
domainname2.com {
tls hb@domainname1.com
root /home/hb/website2
file_server
}
3. The problem I’m having:
Caddy service can’t run. I have two websites on this server, one is visited through proxy, and another one is a static page (index.html).
4. Error messages and/or full log output:
● caddy.service - Caddy
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-11-10 08:25:08 UTC; 6s ago
Docs: https://caddyserver.com/docs/
Process: 8815 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 8815 (code=exited, status=1/FAILURE)
CPU: 38ms
Nov 10 08:25:08 ip-172-26-2-75 caddy[8815]: LANG=en_US.UTF-8
Nov 10 08:25:08 ip-172-26-2-75 caddy[8815]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Nov 10 08:25:08 ip-172-26-2-75 caddy[8815]: HOME=/var/lib/caddy
Nov 10 08:25:08 ip-172-26-2-75 caddy[8815]: LOGNAME=caddy
Nov 10 08:25:08 ip-172-26-2-75 caddy[8815]: USER=caddy
Nov 10 08:25:08 ip-172-26-2-75 caddy[8815]: INVOCATION_ID=befe13c6c716403bbf3dd0ed648383b4
Nov 10 08:25:08 ip-172-26-2-75 caddy[8815]: JOURNAL_STREAM=8:138673
Nov 10 08:25:08 ip-172-26-2-75 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Nov 10 08:25:08 ip-172-26-2-75 systemd[1]: caddy.service: Unit entered failed state.
Nov 10 08:25:08 ip-172-26-2-75 systemd[1]: caddy.service: Failed with result 'exit-code'.
5. What I already tried:
If I remove the domainname2.com’ configure section on Caddyfile, Caddy service can work well.