Fix nginx configuration conflict in docker-compose
- 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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user