Commit 7e79d62b authored by Lukáš Gorazd Hrodek's avatar Lukáš Gorazd Hrodek
Browse files

docker: add nginx configs for SPA festivals 22-23

- nginx-spa-22.conf: serve festival-22 under /archive/22 with strip prefix
- nginx-spa-23.conf: serve festival-23 under /archive/23 with strip prefix
- Both include SPA fallback routing and asset caching
- Support 200.html fallback for client-side routing
parent 0fc0f3b0
Loading
Loading
Loading
Loading
+81 −0
Original line number Diff line number Diff line
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent"';

    access_log /var/log/nginx/access.log main;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    client_max_body_size 500M;

    gzip off;  # Disable gzip for sub_filter to work properly
    
    # Increase buffer sizes for sub_filter
    proxy_buffering on;
    proxy_buffer_size 128k;
    proxy_buffers 100 128k;
    proxy_busy_buffers_size 256k;
    sub_filter_last_modified on;

    server {
        listen 80;
        server_name localhost;
        root /usr/share/nginx/html;
        index index.html;

        # Paths are already rewritten at container startup by entrypoint script
        # No need for sub_filter - it was causing double-path issues

        # Gatsby/statické assety
        location /static/ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        location /fonts/ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        location /images/ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        location /page-data/ {
            try_files $uri =404;
            expires 5m;
            add_header Cache-Control "public";
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|mp4|webm|ogg|webmanifest|json|map|webp)$ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        # SPA routing
        location / {
            try_files $uri $uri/ /index.html;
        }
    }
}
+81 −0
Original line number Diff line number Diff line
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent"';

    access_log /var/log/nginx/access.log main;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    client_max_body_size 500M;

    gzip off;  # Disable gzip for sub_filter to work properly
    
    # Increase buffer sizes for sub_filter
    proxy_buffering on;
    proxy_buffer_size 128k;
    proxy_buffers 100 128k;
    proxy_busy_buffers_size 256k;
    sub_filter_last_modified on;

    server {
        listen 80;
        server_name localhost;
        root /usr/share/nginx/html;
        index index.html;

        # Paths are already rewritten at container startup by entrypoint script
        # No need for sub_filter - it was causing double-path issues

        # Gatsby/statické assety
        location /static/ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        location /fonts/ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        location /images/ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        location /page-data/ {
            try_files $uri =404;
            expires 5m;
            add_header Cache-Control "public";
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|mp4|webm|ogg|webmanifest|json|map|webp)$ {
            try_files $uri =404;
            expires 1y;
            add_header Cache-Control "public, immutable";
        }

        # SPA routing
        location / {
            try_files $uri $uri/ /index.html;
        }
    }
}