From f201d0f9adf9e0d31b6c89b8b47858eb7a8ff39a Mon Sep 17 00:00:00 2001 From: "Niels G. W. Serup" Date: Fri, 2 Sep 2016 23:47:31 +0200 Subject: [PATCH] 404 handler --- nginx/base.conf | 6 ++++++ scripts/transform-file.py | 2 +- site/404.md | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 site/404.md diff --git a/nginx/base.conf b/nginx/base.conf index b3dfb7f..310f0b1 100644 --- a/nginx/base.conf +++ b/nginx/base.conf @@ -3,6 +3,12 @@ server_name metanohi.name www.metanohi.name; root /var/www/metanohi.name/web-serve; index index.html; +error_page 404 /404.html + +location /404 { + internal; +} + location ~ \.html$ { internal; } diff --git a/scripts/transform-file.py b/scripts/transform-file.py index c1984c8..435567f 100755 --- a/scripts/transform-file.py +++ b/scripts/transform-file.py @@ -97,7 +97,7 @@ def markdown_to_html(input_file, output_dir): pages.append((dir + '/' + uri, os.path.normpath(os.path.join(base_dir, path, name)))) - builtins = ['/', '/about/', '/about/niels', '/misc/'] + builtins = ['/', '/about/', '/about/niels', '/misc/', '/404'] pages = filter(lambda t: t[0] not in builtins, pages) pages_new = [] for page in pages: diff --git a/site/404.md b/site/404.md new file mode 100644 index 0000000..03c89cb --- /dev/null +++ b/site/404.md @@ -0,0 +1,3 @@ +# 404 + +Try the next exit.