# Loaded by the standard nginx image inside the http context. # TLS is terminated by the existing external reverse proxy (Pangolin). map $uri $olapka_canonical_path { # Re-evaluate after internal error_page redirects. volatile; default $uri; ~^/index(?:\.html)?/?$ /; ~^/(business-animation|contacts|legal|personal-animation|portfolio|services|social-animation)(?:\.html/?|/)$ /$1; } server { listen 80; server_name www.olapka.ru; return 301 https://olapka.ru$olapka_canonical_path$is_args$args; } server { listen 80; server_name olapka.ru; root /usr/share/nginx/html; charset utf-8; charset_types text/plain text/css text/markdown application/javascript application/json application/xml image/svg+xml; gzip on; gzip_vary on; gzip_proxied any; gzip_min_length 512; gzip_comp_level 5; gzip_types text/plain text/css text/markdown application/javascript application/json application/xml text/xml image/svg+xml; # /404 is an error too, never a successful content page. location = /404 { return 404; } error_page 404 =404 /404.html; location = /404.html { internal; } # Only return redirects here; no rewrite loops or HTTPS checks behind proxy. if ($uri != $olapka_canonical_path) { return 301 https://olapka.ru$olapka_canonical_path$is_args$args; } # try_files serves an existing file in-place, without a client redirect. location = / { try_files /index.html =404; } location = /business-animation { try_files /business-animation.html =404; } location = /contacts { try_files /contacts.html =404; } location = /legal { try_files /legal.html =404; } location = /personal-animation { try_files /personal-animation.html =404; } location = /portfolio { try_files /portfolio.html =404; } location = /services { try_files /services.html =404; } location = /social-animation { try_files /social-animation.html =404; } # Machine-readable site summaries (UTF-8 Markdown in .txt files). location ~ ^/llms(?:-full)?\.txt$ { types { } default_type text/plain; charset utf-8; add_header Cache-Control "public, max-age=3600"; try_files $uri =404; } # Keep the source legal page's noindex policy on its Markdown copy. location = /legal.md { types { } default_type text/markdown; charset utf-8; add_header X-Robots-Tag "noindex, follow"; add_header Link '; rel="describedby"'; try_files $uri =404; } location ~ ^/(index|services|personal-animation|business-animation|social-animation|portfolio|contacts)\.md$ { types { } default_type text/markdown; charset utf-8; add_header Cache-Control "public, max-age=3600"; add_header Link '; rel="describedby"'; try_files $uri =404; } # Revalidate changed assets after one hour (filenames are not versioned). location ~ ^/(?:css|js|img|video)/ { add_header Cache-Control "public, max-age=3600"; try_files $uri =404; } # Real assets are served normally. Unknown URLs return a real 404. location / { try_files $uri =404; } }