Repository navigation
Expand file tree
/
Copy pathnginx.conf
More file actions
82 lines (68 loc) · 1.95 KB
/
Copy pathnginx.conf
File metadata and controls
82 lines (68 loc) · 1.95 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
daemon off;
user nginx nginx;
worker_processes 1;
error_log stderr warn;
worker_rlimit_nofile 8192;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
charset utf-8;
sendfile on;
tcp_nopush on;
gzip_static on;
brotli_static on;
port_in_redirect off;
server_name_in_redirect off;
# Redirects
map_hash_bucket_size 256;
map $request_uri $uri_without_slash {
"~(?<u>(.+))/$" $u;
default $request_uri;
}
map $uri_without_slash $redirect_uri {
include redirects.map;
default "";
}
# Content negotiation: clients asking for markdown (Claude sends
# `Accept: text/markdown`) get the llms.txt rendition of the same URL.
map $http_accept $negotiated_index {
~*text/markdown llms.txt;
default index.html;
}
server {
listen 8080;
access_log /dev/stdout;
root /app/public;
add_header Vary Accept;
location ~ ^/openapi(.*)\.json$ {
add_header Access-Control-Allow-Origin *;
add_header Vary Accept;
}
# bin/compress.js writes a .br/.gz sibling for every file. gzip_static and
# brotli_static read those from disk while serving the original URL, so the
# siblings need no URL of their own. A genuine .br/.gz download would need
# an exception here.
location ~ \.(br|gz)$ {
internal;
}
# The markdown rendition Hugo writes alongside each index.html. `internal`
# keeps it reachable only via the negotiation above, so every page has
# exactly one public URL. mime.types would serve it as text/plain.
location ~ (^|/)llms\.txt$ {
internal;
types { }
default_type text/markdown;
charset_types text/markdown;
}
if ($redirect_uri != "") {
rewrite ^(.*)$ $redirect_uri redirect;
}
index $negotiated_index index.html;
error_page 404 /404.html;
}
}