The error I get is:
http: TLS handshake error from 63.143.42.245:48140: no certificate available for āsand-box.onlineā
http: TLS handshake error from 41.80.45.8:52851: no certificate available for āsand-box.onlineā
The ports 445 and 80 are open.
The previous configurations worked well:
sand-box.online{
root * /var/www
encode gzip
php_fastcgi unix//run/php/php7.4-fpm.sock
file_server
log {
output file /var/log/caddy/sandbox.log
format console
}
}
When I added the new configurations and added the subdomain, the certificate issue stopped and got an error
4. Error messages and/or full log output:
The error from journalctl -xe:
http: TLS handshake error from 63.143.42.245:48140: no certificate available for āsand-box.onlineā
http: TLS handshake error from 41.80.45.8:52851: no certificate available for āsand-box.onlineā
The Caddyfile uses spaces primarily to delimit ātokensā, so Caddy would read this as a literal domain www.sand-box.online{ - there needs to be a space here between the domain and the opening brace.
The fact that you state it worked previously with this issue seems odd.
Iām not seeing any other issues with your Caddyfile.
Can you share the journal output from the reload process?
Thank you soo much!!! It worked. I was stuck on it for a while, checking documentation and forums. It was the space between the domain and curly bracket.
Formats the Caddyfile by adding proper indentation and spaces to improve human readability.
In this case it would change behaviour, which I imagine is not the intention of fmt?
It seems to me that if you miss out this space then Caddy should either understand or consider the Caddyfile invalid. Either way, the user wouldnāt get a confusing error message unrelated to the actual problem.
A bug would be if the Caddyfile deviated from the specification.
In this case, the specification requires a space between the site label (i.e. the domain) and the opening brace, so it is not a bug if the Caddyfile follows this convention in practice.
Caddy can serve very arbitrary hostnames, but itās not intelligent like you and I; it doesnāt look at that example and think, āthatās almost a real public domain, except for the { on the end, maybe it was a mistake?ā. Caddy assumes a lot of sane defaults, but I think it would be anti-user to assume outright mistakes like this.