diff options
| author | CaptainJack2491 <jayrupnakawala@gmail.com> | 2025-12-27 16:39:29 +0000 |
|---|---|---|
| committer | CaptainJack2491 <jayrupnakawala@gmail.com> | 2025-12-27 16:39:29 +0000 |
| commit | a2fac7bc0b1a5d825b8ed8d07923a17cb16dc32c (patch) | |
| tree | 7b38225470d75f950b6ccfcd93b02a1b431acb58 /nginx.conf | |
inital commit
Diffstat (limited to 'nginx.conf')
| -rw-r--r-- | nginx.conf | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..cf4b30e --- /dev/null +++ b/nginx.conf @@ -0,0 +1,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; + } +} + |
