Caddy and Web Service Troubleshooting Guide
ServBay uses Caddy as the default web server. In daily use, users may encounter issues such as websites not loading. Below are some common issues and their solutions.
Using ServBay's Built-in Tools for Troubleshooting
ServBay comes with a powerful diagnostic tool. We recommend using the built-in troubleshooting tool for self-diagnosis and resolution.
Open the ServBay application and find Troubleshooting
in the left navigation to access the built-in troubleshooting tool.
Check the Caddyfile
If you wish to troubleshoot manually, you can follow some of the steps below.
Use Caddy's built-in validation function to check if the Caddyfile is correct. Please run the command below:
$ /Applications/ServBay/bin/caddy validate -c /Applications/ServBay/etc/caddy/Caddyfile
If it returns Valid configuration
, everything is fine. If it returns another error code, follow the prompts based on the error code. (Note: The command above will have a lot of INFO and WARN outputs, which is normal and won't affect the service's operation.)
Certificate Errors
If you see an error like loading certificates: open xxxxx: no such file or directory
, it means that the certificate file does not exist. Please check if the path to the certificate file is correct.
2024/12/09 17:24:16.970 INFO using config from file {"file": "/Applications/ServBay/etc/caddy/Caddyfile"}
2024/12/09 17:24:16.991 INFO adapted config to JSON {"adapter": "caddyfile"}
2024/12/09 17:24:16.991 WARN Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies {"adapter": "caddyfile", "file": "/Applications/ServBay/etc/caddy/Caddyfile", "line": 8}
2024/12/09 17:24:16.999 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0x1400121f300"}
2024/12/09 17:24:17.006 INFO tls.cache.maintenance stopped background certificate maintenance {"cache": "0x1400121f300"}
Error: loading http app module: provision http: getting tls app: loading tls app module: provision tls: loading certificates: open /Applications/ServBay/ssl/private/tls-certs/mail.servbay.host/mail.servbay.host.1crt: no such file or directory
2
3
4
5
6
7
Website Directory Errors
If you get the error parsing caddyfile tokens for 'root': too many arguments
, check if there are spaces in the path of the website directory. This is a very common mistake.
For example, root * /Applications/ServBay/www/public web
has a space between public
and web
, which makes it treated as two arguments, leading to an error. The correct way to set it is to wrap the path in double quotes ("). For instance, root * "/Applications/ServBay/www/public web"
.
We strongly recommend avoiding spaces and special characters in any filenames or paths. You can use -
or _
to separate words, such as: public-folder
, public_dir
.
2024/12/09 17:26:37.371 INFO using config from file {"file": "/Applications/ServBay/etc/caddy/Caddyfile"}
Error: adapting config using caddyfile: parsing caddyfile tokens for 'root': too many arguments; should only be a matcher and a path, at /Applications/ServBay/etc/caddy/Caddyfile:1388
2
3
Rewrite Rule Errors
Using incorrect Rewrite rules in Caddy, such as directly using NGINX rules, can also lead to errors.