# Upstream block - Optional for load balancing
# upstream hello_django {
#     server web:8000;
# }

server {
    listen 80;
    server_name djp.manjurulhoque.com;

    # Proxy pass to the Django app
    location / {
        proxy_pass http://web:8000;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    # Serve static files
    location /static/ {
        alias /usr/src/app/staticfiles/;
    }

    # Serve media files
    location /media/ {
        alias /usr/src/app/mediafiles/;
    }
}

# Default server block to catch all other traffic
# server {
#     listen 80 default_server;
#     server_name _;  # Catch-all for any requests not matching
#     return 444;  # Or any other appropriate response
# }
