diff options
| author | Christian Cleberg <[email protected]> | 2026-05-01 10:29:58 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-05-01 10:29:58 -0500 |
| commit | a5d3ecf0aebe1802e4bf8ba834693996425a707f (patch) | |
| tree | 3edf80ea380fc81d2ec8a64c337b0a47f222ea3a | |
| parent | f11fc68a0acc6eef606c46504a4388564ec4f96a (diff) | |
| download | dotfiles-a5d3ecf0aebe1802e4bf8ba834693996425a707f.tar.gz dotfiles-a5d3ecf0aebe1802e4bf8ba834693996425a707f.tar.bz2 dotfiles-a5d3ecf0aebe1802e4bf8ba834693996425a707f.zip | |
fix: enable markdown serving via org on cleberg.net
| -rw-r--r-- | linux/nginx/etc/nginx/conf.d/cleberg.net.conf | 39 | ||||
| -rw-r--r-- | linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf | 19 |
2 files changed, 53 insertions, 5 deletions
diff --git a/linux/nginx/etc/nginx/conf.d/cleberg.net.conf b/linux/nginx/etc/nginx/conf.d/cleberg.net.conf index 7fcb683..04cd3c5 100644 --- a/linux/nginx/etc/nginx/conf.d/cleberg.net.conf +++ b/linux/nginx/etc/nginx/conf.d/cleberg.net.conf @@ -10,7 +10,44 @@ server { add_header Onion-Location "http://paske4urhs6nttrtlkuwa5cowum3fjkc6yv6kl4ncx3mjxcd77764nqd.onion$request_uri" always; - include custom.d/sites/cleberg_net_static_locations.conf; + location /org/ { + internal; + alias /var/www/cleberg.net/org/; + default_type text/markdown; + add_header Content-Type "text/markdown; charset=utf-8" always; + add_header Vary "Accept" always; + } + + location = / { + if ($http_accept ~* "text/markdown") { + rewrite ^/$ /org/index.org last; + } + + add_header Vary "Accept" always; + try_files /index.html =404; + } + + location / { + try_files $uri $uri/ =404; + } + + location /blog/ { + rewrite ^/blog/((?!index)[^/]+)/(.*)$ /blog/$1.html permanent; + if ($http_accept ~* "text/markdown") { + rewrite ^/blog/([^/]+)\.html$ /org/blog/$1.org last; + } + } + + location ~ ^/(.+)\.html$ { + if ($http_accept ~* "text/markdown") { + rewrite ^/(.+)\.html$ /org/$1.org last; + } + add_header Vary "Accept" always; + try_files $uri =404; + } + + location /atom.xml { return 301 $scheme://$host/feed.xml; } + location /blog/salary-transparency.html { return 301 $scheme://$host/salary/; } } server { diff --git a/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf b/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf index b8764b3..2ece0d1 100644 --- a/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf +++ b/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf @@ -1,8 +1,18 @@ location /org/ { internal; alias /var/www/cleberg.net/org/; - default_type text/plain; - add_header Content-Type "text/plain; charset=utf-8"; + default_type text/markdown; + add_header Content-Type "text/markdown; charset=utf-8" always; + add_header Vary "Accept" always; +} + +location = / { + if ($http_accept ~* "text/markdown") { + rewrite ^/$ /org/index.org last; + } + + add_header Vary "Accept" always; + try_files /index.html =404; } location / { @@ -16,10 +26,11 @@ location /blog/ { } } -location ~ ^/([^/]+)\.html$ { +location ~ ^/(.+)\.html$ { if ($http_accept ~* "text/markdown") { - rewrite ^/([^/]+)\.html$ /org/$1.org last; + rewrite ^/(.+)\.html$ /org/$1.org last; } + add_header Vary "Accept" always; try_files $uri =404; } |
