server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;

    root /var/www/html/public;
    index index.php;
    charset utf-8;

    client_max_body_size 100M;

    resolver 127.0.0.11 valid=10s ipv6=off;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";
    add_header Referrer-Policy "strict-origin-when-cross-origin";

    # --- Static assets, served straight from the mounted project ---
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp|avif)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
        access_log off;
        try_files $uri @application;
    }

    location = /favicon.ico { access_log off; log_not_found off; }

    # --- Everything else, PHP included, goes to the application container ---
    location / {
        include /etc/nginx/conf.d/proxy.inc;
    }

    location @application {
        include /etc/nginx/conf.d/proxy.inc;
    }

    # --- Deny dotfiles ---
    location ~ /\.(?!well-known).* {
        deny all;
    }

    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
}
