caddy example
This commit is contained in:
@@ -67,17 +67,49 @@ sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
#### Option B: Caddy (Simpler)
|
||||
#### Option B: Caddy (Recommended - Automatic HTTPS!)
|
||||
|
||||
Create `/etc/caddy/Caddyfile`:
|
||||
Caddy is simpler than Nginx and handles HTTPS automatically with Let's Encrypt.
|
||||
|
||||
```bash
|
||||
# Install Caddy (if not already installed)
|
||||
# Ubuntu/Debian:
|
||||
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
sudo apt update
|
||||
sudo apt install caddy
|
||||
|
||||
# Copy and edit the example Caddyfile
|
||||
sudo cp Caddyfile.example /etc/caddy/Caddyfile
|
||||
|
||||
# Update your domain in the Caddyfile
|
||||
sudo nano /etc/caddy/Caddyfile
|
||||
|
||||
# Validate configuration
|
||||
caddy validate --config /etc/caddy/Caddyfile
|
||||
|
||||
# Restart Caddy
|
||||
sudo systemctl restart caddy
|
||||
|
||||
# Check status
|
||||
sudo systemctl status caddy
|
||||
```
|
||||
|
||||
**Simple Caddyfile (minimal):**
|
||||
```caddy
|
||||
trivia.torrtle.co {
|
||||
reverse_proxy localhost:5001
|
||||
}
|
||||
```
|
||||
|
||||
Caddy automatically handles HTTPS with Let's Encrypt!
|
||||
**That's it!** Caddy automatically:
|
||||
- Obtains SSL certificate from Let's Encrypt
|
||||
- Handles WebSocket upgrades
|
||||
- Redirects HTTP to HTTPS
|
||||
- Renews certificates automatically
|
||||
|
||||
See `Caddyfile.example` for advanced configuration with security headers, logging, and optional features.
|
||||
|
||||
## Services
|
||||
|
||||
|
||||
Reference in New Issue
Block a user