Commit 920c5e5844
Verified · cmc
Layout: unified · split
linux/nginx/etc/nginx/conf.d/cleberg.net.conf +39 −48
| @@ -7,64 +7,55 @@ server { | |||
| 7 | include custom.d/security/content-security-policy.conf; | 7 | include custom.d/security/content-security-policy.conf; |
| 8 | include custom.d/security/permissions-policy.conf; | 8 | include custom.d/security/permissions-policy.conf; |
| 9 | root /var/www/cleberg.net/; | 9 | root /var/www/cleberg.net/; |
| 10 | include custom.d/redirects/blog.conf; | ||
| 10 | port_in_redirect off; | 11 | port_in_redirect off; |
| 11 | 12 | ||
| 12 | add_header Onion-Location "http://paske4urhs6nttrtlkuwa5cowum3fjkc6yv6kl4ncx3mjxcd77764nqd.onion$request_uri" always; | 13 | add_header Onion-Location "http://paske4urhs6nttrtlkuwa5cowum3fjkc6yv6kl4ncx3mjxcd77764nqd.onion$request_uri" always; |
| 13 | 14 | ||
| 14 | location /org/ { | 15 | location /org/ { |
| 15 | internal; | 16 | internal; |
| 16 | alias /var/www/cleberg.net/org/; | 17 | alias /var/www/cleberg.net/org/; |
| 17 | default_type text/markdown; | 18 | default_type text/markdown; |
| 18 | add_header Content-Type "text/markdown; charset=utf-8" always; | 19 | add_header Content-Type "text/markdown; charset=utf-8" always; |
| 19 | add_header Vary "Accept" always; | 20 | add_header Vary "Accept" always; |
| 20 | } | 21 | } |
| 21 | |||
| 22 | location = / { | ||
| 23 | if ($http_accept ~* "text/markdown") { | ||
| 24 | rewrite ^/$ /org/index.org last; | ||
| 25 | } | ||
| 26 | 22 | ||
| 27 | add_header Vary "Accept" always; | 23 | location = / { |
| 28 | try_files /index.html =404; | 24 | if ($http_accept ~* "text/markdown") { |
| 29 | } | 25 | rewrite ^/$ /org/index.org last; |
| 26 | } | ||
| 30 | 27 | ||
| 31 | location / { | 28 | add_header Vary "Accept" always; |
| 32 | try_files $uri $uri/ =404; | 29 | try_files /index.html =404; |
| 33 | } | 30 | } |
| 34 | 31 | ||
| 35 | location /blog/ { | 32 | location / { |
| 36 | rewrite ^/blog/((?!index)[^/]+)/(.*)$ /blog/$1.html permanent; | 33 | try_files $uri $uri/ =404; |
| 37 | if ($http_accept ~* "text/markdown") { | 34 | } |
| 38 | rewrite ^/blog/([^/]+)\.html$ /org/blog/$1.org last; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | 35 | ||
| 42 | location ~ ^/(.+)\.html$ { | 36 | location /blog/ { |
| 43 | if ($http_accept ~* "text/markdown") { | 37 | rewrite ^/blog/((?!index)[^/]+)/(.*)$ /blog/$1.html permanent; |
| 44 | rewrite ^/(.+)\.html$ /org/$1.org last; | 38 | if ($http_accept ~* "text/markdown") { |
| 45 | } | 39 | rewrite ^/blog/([^/]+)\.html$ /org/blog/$1.org last; |
| 46 | add_header Vary "Accept" always; | 40 | } |
| 47 | try_files $uri =404; | 41 | } |
| 48 | } | ||
| 49 | 42 | ||
| 50 | location /atom.xml { return 301 $scheme://$host/feed.xml; } | 43 | location ~ ^/(.+)\.html$ { |
| 51 | location /blog/salary-transparency.html { return 301 $scheme://$host/salary/; } | 44 | if ($http_accept ~* "text/markdown") { |
| 52 | include custom.d/redirects/blog.conf; | 45 | rewrite ^/(.+)\.html$ /org/$1.org last; |
| 46 | } | ||
| 47 | add_header Vary "Accept" always; | ||
| 48 | try_files $uri =404; | ||
| 49 | } | ||
| 53 | } | 50 | } |
| 54 | 51 | ||
| 55 | server { | 52 | server { |
| 56 | listen 10012; | 53 | listen 10012; |
| 57 | server_name hutch.cleberg.net; | 54 | server_name hutch.cleberg.net; |
| 58 | include custom.d/basic.conf; | 55 | include custom.d/basic.conf; |
| 59 | include custom.d/security/strict-transport-security.conf; | 56 | include custom.d/security/strict-transport-security.conf; |
| 60 | include custom.d/security/content-security-policy.conf; | 57 | include custom.d/security/content-security-policy.conf; |
| 61 | include custom.d/security/permissions-policy.conf; | 58 | include custom.d/security/permissions-policy.conf; |
| 62 | 59 | location = /privacy.html { return 301 https://zerolabs.sh/hutch/privacy-policy/; } | |
| 63 | location = /privacy.html { | 60 | location = / { return 301 https://zerolabs.sh/hutch/; } |
| 64 | return 301 https://zerolabs.sh/hutch/privacy-policy/; | ||
| 65 | } | ||
| 66 | |||
| 67 | location = / { | ||
| 68 | return 301 https://zerolabs.sh/hutch/; | ||
| 69 | } | ||
| 70 | } | 61 | } |