1. Caddy version (caddy version
):
v2.4.6
2. How I run Caddy:
As a reverse-proxy in front of Apache.
a. System environment:
AlmaLinux release 8.5
b. Command:
caddy run
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
sub.domain.tld:443 {
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
-Server
}
encode gzip
log {
output file /var/log/caddy-access.log
format json
}
tls /root/.acme.sh/sub.domain.tld_ecc/fullchain.cer /root/.acme.sh/sub.domain.tld_ecc/sub.domain.tld.key {
protocols tls1.3
}
reverse_proxy 127.0.0.1:81 {
}
}
3. The problem I’m having:
Updating the SSL cert(s) fails. I use acme.sh. If I run the following code [root@sub ~]# acme.sh --cron --force
, I get the error listed below. I couldn’t find any info on this issue. I can’t believe I’m the only one. If I manually stop Caddy and run the same command, the cert gets renewed. What’s the proper way to resolve this issue? I do want auto HTTP->HTTPS but I also want my cert to get auto-renewed as well
4. Error messages and/or full log output:
[Sun Jan 2 15:15:44 EST 2022] ===Starting cron===
[Sun Jan 2 15:15:44 EST 2022] Renew: 'sub.domain.tld'
[Sun Jan 2 15:15:44 EST 2022] Using CA: https://acme-v02.api.letsencrypt.org/directory
[Sun Jan 2 15:15:45 EST 2022] Standalone mode.
[Sun Jan 2 15:15:45 EST 2022] LISTEN 0 128 *:80 *:* users:(("caddy",pid=1388,fd=7))
[Sun Jan 2 15:15:45 EST 2022] tcp port 80 is already used by (("caddy",pid=1388,fd=7))
[Sun Jan 2 15:15:45 EST 2022] Please stop it first
[Sun Jan 2 15:15:45 EST 2022] _on_before_issue.
[Sun Jan 2 15:15:45 EST 2022] Error renew sub.domain.tld.
[Sun Jan 2 15:15:45 EST 2022] Renew: 'sub.domain.tld'
[Sun Jan 2 15:15:45 EST 2022] Using CA: https://acme-v02.api.letsencrypt.org/directory
[Sun Jan 2 15:15:45 EST 2022] Standalone mode.
[Sun Jan 2 15:15:45 EST 2022] LISTEN 0 128 *:80 *:* users:(("caddy",pid=1388,fd=7))
[Sun Jan 2 15:15:45 EST 2022] tcp port 80 is already used by (("caddy",pid=1388,fd=7))
[Sun Jan 2 15:15:45 EST 2022] Please stop it first
[Sun Jan 2 15:15:45 EST 2022] _on_before_issue.
[Sun Jan 2 15:15:45 EST 2022] Error renew sub.domain.tld_ecc.
[Sun Jan 2 15:15:45 EST 2022] ===End cron===
5. What I already tried:
I’m not sure where to begin troubleshooting. Everything works except for the fact that the SSL cert(s) will not auto-renew because Caddy is listening on port 80 even though I specified a domain and port 443 in Caddyfile.