From 6d3c345e75b46e7cfff2a5c5717315f5b2f78088 Mon Sep 17 00:00:00 2001 From: Adrien Beaudouin Date: Mon, 1 Jan 2024 14:37:24 +0100 Subject: [PATCH] add redirects support --- .gitignore | 3 ++- Dockerfile | 4 ++++ nginx/default.conf | 16 ++++++++++++++++ nginx/redirects.conf | 3 +++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 nginx/default.conf create mode 100644 nginx/redirects.conf diff --git a/.gitignore b/.gitignore index 9072c2f..958e430 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -resources \ No newline at end of file +resources +public \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 62ce5f5..f6c01ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,7 @@ FROM nginx:alpine +RUN sed -i 's/^\(.*\)http {/\1http {\n map_hash_bucket_size 128;\n/' /etc/nginx/nginx.conf + +COPY nginx/ /etc/nginx/conf.d/ + COPY public /usr/share/nginx/html diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..846314a --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,16 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + + if ($new_uri != "") { + rewrite ^(.*)$ $new_uri permanent; + } + } + + error_page 404 /404.html; +} \ No newline at end of file diff --git a/nginx/redirects.conf b/nginx/redirects.conf new file mode 100644 index 0000000..bc09afb --- /dev/null +++ b/nginx/redirects.conf @@ -0,0 +1,3 @@ +map $request_uri $new_uri { + /2023/12/a-2024-benchmark-of-main-web-apis-frameworks/ /2023/12/a-2024-benchmark-of-main-web-api-frameworks/; +} \ No newline at end of file