blob: cf4b30eece49d09e4042feb3a6103da0a83bcf9b (
plain)
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
|
server {
listen 80;
server_name jayrup.me;
root /usr/share/nginx/html;
index index.html;
# Helper variable: detect text clients
set $want_text 0;
if ($http_user_agent ~* "(curl|wget)") {
set $want_text 1;
}
if ($http_accept ~* "text/plain") {
set $want_text 1;
}
# Home
location = / {
if ($want_text) {
rewrite ^ /index.txt break;
}
try_files /index.html =404;
}
# Projects
location = /projects {
if ($want_text) {
rewrite ^ /projects.txt break;
}
try_files /projects.html =404;
}
# CV
location = /cv {
if ($want_text) {
rewrite ^ /cv.txt break;
}
try_files /cv.html =404;
}
# Force correct type for text files
location ~ \.txt$ {
default_type text/plain;
}
}
|