From 1971766cc231b9f693b904673d79c3dc29b811d1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 1 Apr 2024 23:58:05 +0900 Subject: fix(blog/proxy): fix an issue where one cannot access to slash-less path # Problem Access to `https://blog.nsfisis.dev/foo/bar` was redirected to `http://127.0.0.1/foo/bar/`. # Cause Nginx inside Docker container listened to port 80, but Docker bound the port to the host's 8001 port. The reverse proxy, mioproxy, was configured to rewrite `http://127.0.0.1:8001/*` to `https://blog.nsfisis.dev/*`, which cannot handle `http://127.0.0.1:80/*`. # Solution Change the inner port that Nginx listens to to 8001. Also update mioproxy version. --- vhosts/blog/nginx.conf | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'vhosts/blog/nginx.conf') diff --git a/vhosts/blog/nginx.conf b/vhosts/blog/nginx.conf index 6696aa34..36deb549 100644 --- a/vhosts/blog/nginx.conf +++ b/vhosts/blog/nginx.conf @@ -1,6 +1,6 @@ server { - listen 80 default; - listen [::]:80; + listen 8001 default; + listen [::]:8001; location / { root /public; @@ -14,17 +14,17 @@ server { error_page 404 /404.html; # Old URLs. - rewrite ^/posts/(my-first-post)/?$ https://blog.nsfisis.dev/posts/2021-03-05/$1/ permanent; - rewrite ^/posts/(phperkaigi-2021)/?$ https://blog.nsfisis.dev/posts/2021-03-30/$1/ permanent; - rewrite ^/posts/(cpp-you-can-use-keywords-in-attributes)/?$ https://blog.nsfisis.dev/posts/2021-10-02/$1/ permanent; - rewrite ^/posts/(python-unbound-local-error)/?$ https://blog.nsfisis.dev/posts/2021-10-02/$1/ permanent; - rewrite ^/posts/(ruby-detect-running-implementation)/?$ https://blog.nsfisis.dev/posts/2021-10-02/$1/ permanent; - rewrite ^/posts/(ruby-then-keyword-and-case-in)/?$ https://blog.nsfisis.dev/posts/2021-10-02/$1/ permanent; - rewrite ^/posts/(rust-where-are-primitive-types-from)/?$ https://blog.nsfisis.dev/posts/2021-10-02/$1/ permanent; - rewrite ^/posts/(vim-difference-between-autocmd-bufwrite-and-bufwritepre)/?$ https://blog.nsfisis.dev/posts/2021-10-02/$1/ permanent; - rewrite ^/posts/(vim-swap-order-of-selected-lines)/?$ https://blog.nsfisis.dev/posts/2021-10-02/$1/ permanent; - rewrite ^/posts/(phperkaigi-2022-tokens)/?$ https://blog.nsfisis.dev/posts/2022-04-09/$1/ permanent; + rewrite ^/posts/(my-first-post)/?$ /posts/2021-03-05/$1/ permanent; + rewrite ^/posts/(phperkaigi-2021)/?$ /posts/2021-03-30/$1/ permanent; + rewrite ^/posts/(cpp-you-can-use-keywords-in-attributes)/?$ /posts/2021-10-02/$1/ permanent; + rewrite ^/posts/(python-unbound-local-error)/?$ /posts/2021-10-02/$1/ permanent; + rewrite ^/posts/(ruby-detect-running-implementation)/?$ /posts/2021-10-02/$1/ permanent; + rewrite ^/posts/(ruby-then-keyword-and-case-in)/?$ /posts/2021-10-02/$1/ permanent; + rewrite ^/posts/(rust-where-are-primitive-types-from)/?$ /posts/2021-10-02/$1/ permanent; + rewrite ^/posts/(vim-difference-between-autocmd-bufwrite-and-bufwritepre)/?$ /posts/2021-10-02/$1/ permanent; + rewrite ^/posts/(vim-swap-order-of-selected-lines)/?$ /posts/2021-10-02/$1/ permanent; + rewrite ^/posts/(phperkaigi-2022-tokens)/?$ /posts/2022-04-09/$1/ permanent; # I mistakenly wrote 2023 in the URL instead of 2024. - rewrite ^/posts/2023-01-10/(neovim-insert-namespace-declaration-to-empty-php-file)/?$ https://blog.nsfisis.dev/posts/2024-01-10/$1/ permanent; + rewrite ^/posts/2023-01-10/(neovim-insert-namespace-declaration-to-empty-php-file)/?$ /posts/2024-01-10/$1/ permanent; } -- cgit v1.2.3-70-g09d2