Commit a5d3ecf0ae
Verified · cmc
Layout: unified · split
linux/nginx/etc/nginx/conf.d/cleberg.net.conf +38 −1
| @@ -10,7 +10,44 @@ server { | ||
| 10 | 10 | |
| 11 | 11 | add_header Onion-Location "http://paske4urhs6nttrtlkuwa5cowum3fjkc6yv6kl4ncx3mjxcd77764nqd.onion$request_uri" always; |
| 12 | 12 | |
| 13 | include custom.d/sites/cleberg_net_static_locations.conf; | |
| 13 | location /org/ { | |
| 14 | internal; | |
| 15 | alias /var/www/cleberg.net/org/; | |
| 16 | default_type text/markdown; | |
| 17 | add_header Content-Type "text/markdown; charset=utf-8" always; | |
| 18 | add_header Vary "Accept" always; | |
| 19 | } | |
| 20 | ||
| 21 | location = / { | |
| 22 | if ($http_accept ~* "text/markdown") { | |
| 23 | rewrite ^/$ /org/index.org last; | |
| 24 | } | |
| 25 | ||
| 26 | add_header Vary "Accept" always; | |
| 27 | try_files /index.html =404; | |
| 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 | add_header Vary "Accept" always; | |
| 46 | try_files $uri =404; | |
| 47 | } | |
| 48 | ||
| 49 | location /atom.xml { return 301 $scheme://$host/feed.xml; } | |
| 50 | location /blog/salary-transparency.html { return 301 $scheme://$host/salary/; } | |
| 14 | 51 | } |
| 15 | 52 | |
| 16 | 53 | server { |
linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf +15 −4
| @@ -1,8 +1,18 @@ | ||
| 1 | 1 | location /org/ { |
| 2 | 2 | internal; |
| 3 | 3 | alias /var/www/cleberg.net/org/; |
| 4 | default_type text/plain; | |
| 5 | add_header Content-Type "text/plain; charset=utf-8"; | |
| 4 | default_type text/markdown; | |
| 5 | add_header Content-Type "text/markdown; charset=utf-8" always; | |
| 6 | add_header Vary "Accept" always; | |
| 7 | } | |
| 8 | ||
| 9 | location = / { | |
| 10 | if ($http_accept ~* "text/markdown") { | |
| 11 | rewrite ^/$ /org/index.org last; | |
| 12 | } | |
| 13 | ||
| 14 | add_header Vary "Accept" always; | |
| 15 | try_files /index.html =404; | |
| 6 | 16 | } |
| 7 | 17 | |
| 8 | 18 | location / { |
| @@ -16,10 +26,11 @@ location /blog/ { | ||
| 16 | 26 | } |
| 17 | 27 | } |
| 18 | 28 | |
| 19 | location ~ ^/([^/]+)\.html$ { | |
| 29 | location ~ ^/(.+)\.html$ { | |
| 20 | 30 | if ($http_accept ~* "text/markdown") { |
| 21 | rewrite ^/([^/]+)\.html$ /org/$1.org last; | |
| 31 | rewrite ^/(.+)\.html$ /org/$1.org last; | |
| 22 | 32 | } |
| 33 | add_header Vary "Accept" always; | |
| 23 | 34 | try_files $uri =404; |
| 24 | 35 | } |
| 25 | 36 | |