server {
    # TLS termination is done by the reverse proxy.
    listen       80;
    listen  [::]:80;
    server_name  trailbase_documentation;

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

    # File root matching build target location in Dockerfile.
    root   /usr/share/nginx/html;

    # 404 and 500s should load our custom error pages.
    error_page  404              /404.html;
    # error_page  500 502 503 504  /50x/index.html;

    location / {
        # Set long client-side cache TTLs for astro assets. Astro assets carry a
        # content hash in their filename, thus can be cached safely for ever.
        location /_astro/ {
            add_header Cache-Control "public, max-age=31536000, immutable";
        }
        location /particles/ {
            add_header Cache-Control "public, max-age=2592000, immutable";
        }

	# Try resolve $uri in the following order:
        #  * try $uri first
        #  * then $uri/index.html
        #  * finally fall back to 404 error_page below.
        try_files $uri $uri/index.html =404;
    }
}
