-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx.conf
More file actions
46 lines (39 loc) · 1.72 KB
/
Copy pathnginx.conf
File metadata and controls
46 lines (39 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/markdown text/css application/json application/javascript text/xml application/xml text/javascript;
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Serve the LLM-facing Markdown mirrors (/llms.txt, per-page *.md) as UTF-8
# text so browsers and LLM fetchers render them inline instead of downloading.
# (.md is absent from nginx's default mime.types.)
location ~* \.md$ {
default_type "text/markdown; charset=utf-8";
add_header Cache-Control "public, max-age=3600";
}
# Enforce a single canonical URL form: redirect extensionless paths that lack
# a trailing slash to the trailing-slash version (matches Astro's trailingSlash:'always').
# Prevents /path and /path/ from being indexed as duplicate URLs.
# Skips real files (anything containing a "." such as .css, .js, .png, .xml).
if ($request_uri ~ ^(/[^.?]*[^/])(\?.*)?$) {
return 301 $1/$2;
}
# Auth and app routes live on the app subdomain (real 301s instead of
# the meta-refresh stub pages Astro emits for static redirects)
location = /login/ { return 301 https://app.logtide.dev/login; }
location = /register/ { return 301 https://app.logtide.dev/register; }
location = /dashboard/ { return 301 https://app.logtide.dev/dashboard; }
# Handle clean URLs (no .html extension)
location / {
try_files $uri $uri/ $uri.html $uri/index.html =404;
}
# Error pages
error_page 404 /404.html;
}