# Example nginx server block for the Image Library. # # Copy the project into /var/www/image-library (including the generated # images.json), then adapt root/server_name and include this file from your # nginx config (e.g. /etc/nginx/conf.d/image-library.conf). server { listen 80; server_name images.example.com; root /var/www/image-library; index index.html; # Serve the SPA and its assets; fall back to index.html for unknown paths. location / { try_files $uri $uri/ /index.html; } # The manifest changes whenever images are added — don't let clients cache it. location = /images.json { add_header Cache-Control "no-cache"; try_files $uri =404; } # Images are immutable in practice; cache them aggressively. location /img/ { add_header Cache-Control "public, max-age=2592000"; try_files $uri =404; } # Long-cache the static assets (bump the filename or use a build hash if you # change them often). location /assets/ { add_header Cache-Control "public, max-age=604800"; try_files $uri =404; } gzip on; gzip_types text/css application/javascript application/json image/svg+xml; gzip_min_length 1024; # Optional: only needed if you enable HTTPS. navigator.clipboard requires a # secure context; the app falls back to a legacy copy method otherwise. # listen 443 ssl; # ssl_certificate /etc/nginx/ssl/images.example.com.crt; # ssl_certificate_key /etc/nginx/ssl/images.example.com.key; }