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