The key to multiple sites is to share access, not to share faults.
One server can host a number of low-flow websites.Caddy According to Host The real risk is that all domain names share the same proxy configuration: a syntax error occurs when a new site is changed and the old site may also be affected. Each change is therefore subject to backup, formatting, validation, reloading and site-by-site checks. Confirm that each application is already by systemd or the container is stable and listens to different local ports. Reverse agents cannot fix the problem of repeated exits from the upstream process.
DNS & Port meets certificate issuance requirements first
From each domain name A/AAAA The record should point to the current server.80/443 Releases the cloud safety team and the system firewall simultaneously. AAAA The record,IPv6 And you have to really get to this server; error AAAA Could not close temporary folder: %s Use dig Or authority. DNS Panel checks, do not look at the memory of your own computer. Caddy . . . . . . . . . .
A domain name corresponds to a clear site block.
www.example.com {
encode zstd gzip
reverse_proxy 127.0.0.1:3000
}
admin.example.com {
encode zstd gzip
reverse_proxy 127.0.0.1:3001
}Upstream usually writes the host and port, not /api . You need to use it when you want to separate it. handle or handle_path, and whether to remove the prefix. The application itself should know the true external protocol and host, in particular to check trusted agents and forwarded headers Settings.
Configure splits to be verifiable
We can use the station for a while. import Open it. /etc/caddy/sites/*.caddy, but make sure that only the expected files are loaded and that the backup contains the main files and the files that are introduced. new, final, final2 This makes it impossible to determine whether a copy is in force. Shares a snippet that is suitable for a uniform security response header or compressed rules, but not prematurely abstracted.WebSocket Unlike overtime, the imposition of shared resources can affect local demand over time.
We'll verify every change. reload
sudo cp /etc/caddy/Caddyfile /etc/caddy/Caddyfile.backup
sudo caddy fmt --overwrite /etc/caddy/Caddyfile
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
sudo systemctl status caddy --no-pagervalidate If you fail, stop. No. reload. The daily configuration update is used reload Not. stop Again. start;heating allows Caddy Replaces the old configuration with a new configuration to reduce the interruption of connections. If files are split, back-up and validation ranges are also covered.
Site-by-site verification cannot be viewed only on the front page 200
Check for each domain name HTTP Is it right? HTTPS, certificate hostname, homepage, health endpoint, static resource, login or form interface. A The request won't fall. B Station, Unknown Host There will be no unexpected display of management backstage.
curl -I http://www.example.com
curl -I https://www.example.com
curl -fsS https://www.example.com/api/health
journalctl -u caddy --since '10 minutes ago' --no-pager502 hours straight first. curl Upriver, look again. Caddy (a) Logs;TLS Errors check DNS, 80/443 and the certificate log. Caddy Deployment of station one. and HTTPS It's a mistake. This could be supplemented by a basic approach.
Completion criteria
Each domain name only reaches its own local port, application port is closed to the public network, configured to be authenticable and operational reload Get on the line and move over. HTTPS The next entry will bring the same border into the country. Docker Compose Production deployment inspection.
Sources
- Caddy reverse_proxy directiveCaddy Documentation
- Caddy Command LineCaddy Documentation