Commit 971a018ea1
Verified · cmc
Layout: unified · split
linux/nginx/etc/nginx/conf.d/cleberg.net.conf +27 −3
| @@ -19,9 +19,32 @@ server { | |||
| 19 | include custom.d/tls/policy_balanced.conf; | 19 | include custom.d/tls/policy_balanced.conf; |
| 20 | include custom.d/basic.conf; | 20 | include custom.d/basic.conf; |
| 21 | root /var/www/cleberg.net/; | 21 | root /var/www/cleberg.net/; |
| 22 | location / { try_files $uri $uri/ =404; } | 22 | |
| 23 | location /blog/ { rewrite ^/blog/((?!index)[^/]+)/(.*)$ /blog/$1.html permanent; } | 23 | location /org/ { |
| 24 | location /wiki/ { rewrite ^/wiki/((?!index)[^/]+)/(.*)$ /wiki/$1.html permanent; } | 24 | internal; |
| 25 | alias /var/www/cleberg.net/org/; | ||
| 26 | default_type text/plain; | ||
| 27 | add_header Content-Type "text/plain; charset=utf-8"; | ||
| 28 | } | ||
| 29 | |||
| 30 | location / { | ||
| 31 | try_files $uri $uri/ =404; | ||
| 32 | } | ||
| 33 | |||
| 34 | location /blog/ { | ||
| 35 | rewrite ^/blog/((?!index)[^/]+)/(.*)$ /blog/$1.html permanent; | ||
| 36 | if ($http_accept ~* "text/markdown") { | ||
| 37 | rewrite ^/blog/([^/]+)\.html$ /org/blog/$1.org last; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | location ~ ^/([^/]+)\.html$ { | ||
| 42 | if ($http_accept ~* "text/markdown") { | ||
| 43 | rewrite ^/([^/]+)\.html$ /org/$1.org last; | ||
| 44 | } | ||
| 45 | try_files $uri =404; | ||
| 46 | } | ||
| 47 | |||
| 25 | location /atom.xml { return 301 $scheme://$host/feed.xml; } | 48 | location /atom.xml { return 301 $scheme://$host/feed.xml; } |
| 26 | location /blog/salary-transparency.html { return 301 $scheme://$host/salary/; } | 49 | location /blog/salary-transparency.html { return 301 $scheme://$host/salary/; } |
| 27 | } | 50 | } |
| @@ -32,3 +55,4 @@ server { | |||
| 32 | server_name www.cleberg.net cleberg.net; | 55 | server_name www.cleberg.net cleberg.net; |
| 33 | return 301 https://cleberg.net$request_uri; | 56 | return 301 https://cleberg.net$request_uri; |
| 34 | } | 57 | } |
| 58 | |||