- Add HTTPSConfig model for managing HTTPS settings - Add admin routes for HTTPS configuration management - Add beautiful admin template for HTTPS configuration - Add database migration for https_config table - Add CLI utility for HTTPS management - Add setup script for automated configuration - Add Caddy configuration generator and manager - Add comprehensive documentation (3 guides) - Add HTTPS Configuration card to admin dashboard - Implement input validation and security features - Add admin-only access control with audit trail - Add real-time configuration preview - Integrate with existing Caddy reverse proxy Features: - Enable/disable HTTPS from web interface - Configure domain, hostname, IP address, port - Automatic SSL certificate management via Let's Encrypt - Real-time Caddyfile generation and reload - Full audit trail with admin username and timestamps - Support for HTTPS and HTTP fallback access points - Beautiful, mobile-responsive UI Modified files: - app/models/__init__.py (added HTTPSConfig import) - app/blueprints/admin.py (added HTTPS routes) - app/templates/admin/admin.html (added HTTPS card) - docker-compose.yml (added Caddyfile mount and admin port) New files: - app/models/https_config.py - app/blueprints/https_config.html - app/utils/caddy_manager.py - https_manager.py - setup_https.sh - migrations/add_https_config_table.py - migrations/add_email_to_https_config.py - HTTPS_STATUS.txt - Documentation files (3 markdown guides)
76 lines
1.5 KiB
Markdown
Executable File
76 lines
1.5 KiB
Markdown
Executable File
# DigiServer v2 - HTTPS Setup with Caddy
|
|
|
|
This setup uses **Caddy** as a reverse proxy with automatic HTTPS via Let's Encrypt.
|
|
|
|
## Quick Setup
|
|
|
|
### 1. Configure Domain
|
|
Create a `.env` file or edit the existing one:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
Edit `.env` and set:
|
|
```
|
|
DOMAIN=your-domain.com
|
|
EMAIL=admin@your-domain.com
|
|
```
|
|
|
|
### 2. Point Your Domain
|
|
Make sure your domain's DNS A record points to your server's IP address.
|
|
|
|
### 3. Start Services
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
That's it! Caddy will **automatically**:
|
|
- Obtain SSL certificates from Let's Encrypt
|
|
- Renew certificates before expiration
|
|
- Redirect HTTP to HTTPS
|
|
- Enable HTTP/2 and HTTP/3
|
|
|
|
## Access Your Site
|
|
|
|
- **HTTP**: http://your-domain.com (redirects to HTTPS)
|
|
- **HTTPS**: https://your-domain.com
|
|
|
|
## Testing Locally (Without Domain)
|
|
|
|
If you don't have a domain yet, leave DOMAIN as `localhost`:
|
|
```
|
|
DOMAIN=localhost
|
|
```
|
|
|
|
Then access: http://localhost (no HTTPS, but app works)
|
|
|
|
## Certificate Storage
|
|
|
|
SSL certificates are stored in Docker volumes:
|
|
- `caddy-data` - Certificate data
|
|
- `caddy-config` - Caddy configuration
|
|
|
|
## Troubleshooting
|
|
|
|
### Check Caddy logs:
|
|
```bash
|
|
docker logs digiserver-caddy
|
|
```
|
|
|
|
### Verify certificates:
|
|
```bash
|
|
docker exec digiserver-caddy caddy list-certificates
|
|
```
|
|
|
|
### Force certificate renewal:
|
|
```bash
|
|
docker exec digiserver-caddy caddy reload --config /etc/caddy/Caddyfile
|
|
```
|
|
|
|
## Port Forwarding
|
|
|
|
Make sure your firewall/router allows:
|
|
- Port 80 (HTTP - for Let's Encrypt challenge)
|
|
- Port 443 (HTTPS)
|