aboutsummaryrefslogtreecommitdiffhomepage
path: root/services/nuldoc/nginx.conf
diff options
context:
space:
mode:
Diffstat (limited to 'services/nuldoc/nginx.conf')
-rw-r--r--services/nuldoc/nginx.conf60
1 files changed, 58 insertions, 2 deletions
diff --git a/services/nuldoc/nginx.conf b/services/nuldoc/nginx.conf
index 311f600..a67b6ba 100644
--- a/services/nuldoc/nginx.conf
+++ b/services/nuldoc/nginx.conf
@@ -1,11 +1,47 @@
map $http_x_forwarded_host $docroot_path {
hostnames;
- default /public/_;
+ default /public/default;
about.* /public/about;
blog.* /public/blog;
slides.* /public/slides;
}
+map $http_x_forwarded_host $about_domain {
+ hostnames;
+ default about.nsfisis.dev;
+ *.localhost:8000 about.localhost:8000;
+}
+
+map $http_x_forwarded_host $blog_domain {
+ hostnames;
+ default blog.nsfisis.dev;
+ *.localhost:8000 blog.localhost:8000;
+}
+
+map $http_x_forwarded_host $slides_domain {
+ hostnames;
+ default slides.nsfisis.dev;
+ *.localhost:8000 slides.localhost:8000;
+}
+
+map $http_x_forwarded_host $is_about_domain {
+ hostnames;
+ default 0;
+ about.* 1;
+}
+
+map $http_x_forwarded_host $is_blog_domain {
+ hostnames;
+ default 0;
+ blog.* 1;
+}
+
+map $http_x_forwarded_host $is_slides_domain {
+ hostnames;
+ default 0;
+ slides.* 1;
+}
+
server {
listen 80 default;
listen [::]:80;
@@ -27,7 +63,16 @@ server {
error_page 404 /404.html;
# Redirect to canonical path.
- rewrite ^/posts/1/?$ /posts/ permanent;
+ rewrite ^/posts/1/?$ /posts/ permanent;
+ rewrite ^/slides/1/?$ /slides/ permanent;
+
+ # Redirect to posts/slides pages.
+ if ($is_blog_domain) {
+ rewrite ^/?$ /posts/ permanent;
+ }
+ if ($is_slides_domain) {
+ rewrite ^/?$ /slides/ permanent;
+ }
# Old URL patterns.
rewrite ^/posts/(my-first-post)/?$ /posts/2021-03-05/$1/ permanent;
@@ -46,4 +91,15 @@ server {
# Renamed posts.
rewrite ^/posts/2024-03-20/todos-in-my-life/?$ /posts/2024-03-20/my-bucket-list/ permanent;
+
+ # Redirect to new domains.
+ if ($is_about_domain = 0) {
+ rewrite ^/about/?$ http://$about_domain/ permanent;
+ }
+ if ($is_blog_domain = 0) {
+ rewrite ^/posts/(.*)/?$ http://$blog_domain/posts/$1/ permanent;
+ }
+ if ($is_slides_domain = 0) {
+ rewrite ^/slides/(.*)/?$ http://$slides_domain/slides/$1/ permanent;
+ }
}