Fix nginx configuration conflict in docker-compose
Some checks failed
CI/CD Pipeline (Reliable & Simple) / production (push) Has been cancelled
CI/CD Pipeline (Simple & Reliable) / production (push) Has been cancelled
CI/CD Pipeline (Fast) / production (push) Has been cancelled

- Remove default nginx configuration files to prevent conflicts
- Add command to clear /etc/nginx/conf.d/* before starting nginx
- This fixes the 'events directive not allowed here' error
This commit is contained in:
2025-09-15 23:48:46 +02:00
parent b06151739f
commit 9c6b313435

View File

@@ -13,6 +13,8 @@ services:
volumes:
# Use a more robust path that works in CI/CD environments
- ./nginx-zero-downtime.conf:/etc/nginx/nginx.conf:ro
# Remove default nginx configuration to prevent conflicts
- /etc/nginx/conf.d
networks:
- portfolio_net
depends_on:
@@ -26,6 +28,9 @@ services:
# Fallback: if the config file doesn't exist, create a basic one
command: >
sh -c "
# Remove default nginx configuration files to prevent conflicts
rm -rf /etc/nginx/conf.d/*
if [ ! -f /etc/nginx/nginx.conf ]; then
echo 'Creating fallback nginx configuration...'
cat > /etc/nginx/nginx.conf << 'EOF'