diff options
Diffstat (limited to 'nginx.conf')
| -rw-r--r-- | nginx.conf | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -4,7 +4,6 @@ map $http_user_agent $format_suffix { default ""; } -# Also check for Accept: text/plain map $http_accept $final_suffix { "~*text/plain" ".txt"; default $format_suffix; @@ -15,16 +14,34 @@ server { server_name jayrup.me; root /usr/share/nginx/html; + # Serve PDFs directly + location ~* \.pdf$ { + add_header Content-Type application/pdf; + add_header Content-Disposition inline; + try_files $uri =404; + } + + # /cv should point to the PDF + location = /cv { + try_files + /cv$final_suffix + /cv/index$final_suffix + /cv.pdf + =404; + } + + location / { - # This handles: - # 1. /cv -> /cv.txt (for curl) - # 2. /cv -> /cv.html (for browser) - # 3. /projects/ -> /projects/index.txt (for curl) - try_files $uri$final_suffix $uri.html $uri/index$final_suffix $uri/index.html =404; + try_files + $uri$final_suffix + $uri.html + $uri/index$final_suffix + $uri/index.html + =404; } - # Ensure text files are served correctly location ~* \.txt$ { add_header Content-Type text/plain; } } + |
