Replace Nginx/Certbot with Caddy for automatic SSL

- Replaced nginx and certbot services with caddy in docker-compose-prod.yml
- Added Caddyfile configuration with automatic SSL and security headers
- Created setup-caddy.sh script for easy deployment
- Caddy automatically handles Let's Encrypt certificates without manual setup
- Much simpler SSL management compared to nginx/certbot combination
This commit is contained in:
2025-10-01 23:34:43 +02:00
parent c28d4fc4ec
commit 8ffe459d50
3 changed files with 160 additions and 23 deletions

View File

@@ -23,44 +23,30 @@ services:
start_period: 40s
# Keine Abhängigkeit zu nginx, um Dependency-Zyklen zu vermeiden
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
container_name: stargirlnails-nginx
# Caddy Reverse Proxy mit automatischem SSL
caddy:
image: caddy:2-alpine
container_name: stargirlnails-caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
- certbot-certs:/etc/letsencrypt:ro
- certbot-webroot:/var/www/certbot:ro
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data
- caddy-config:/config
networks:
- stargirlnails-network
depends_on:
- stargirlnails
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
# Certbot für SSL-Zertifikate
certbot:
image: certbot/certbot
container_name: stargirlnails-certbot
restart: "no"
volumes:
- certbot-certs:/etc/letsencrypt
- certbot-webroot:/var/www/certbot
networks:
- stargirlnails-network
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
# Volumes für persistente Daten
volumes:
storage-data:
driver: local
certbot-certs:
caddy-data:
driver: local
certbot-webroot:
caddy-config:
driver: local
# Netzwerk für interne Kommunikation