From 1e26ce74992b2dd46c003dd1de8eeb35c3fb3bdb Mon Sep 17 00:00:00 2001 From: Xinpeng Wei Date: Tue, 7 Mar 2023 23:27:26 +0800 Subject: [PATCH 01/30] a typo in postgres `]` should be `)` --- source/_posts/postgres.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_posts/postgres.md b/source/_posts/postgres.md index 0f29944..a2ed36f 100644 --- a/source/_posts/postgres.md +++ b/source/_posts/postgres.md @@ -259,7 +259,7 @@ VALUES ( , ); ### Data -[Select](http://www.postgresql.org/docs/current/static/sql-select.html] all data +[Select](http://www.postgresql.org/docs/current/static/sql-select.html) all data ```sql {.wrap} SELECT * FROM ; ``` From 535ec91929ca3635f2e535f1edb4cb5636f02d91 Mon Sep 17 00:00:00 2001 From: fechin Date: Fri, 10 Mar 2023 08:29:19 +0800 Subject: [PATCH 02/30] Add nginx configuration file --- nginx.conf | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..e69de29 From ffb15b706b80f9e64cc91766279356f809abf922 Mon Sep 17 00:00:00 2001 From: fechin Date: Fri, 10 Mar 2023 08:29:48 +0800 Subject: [PATCH 03/30] Update Dockerfile and nginx.conf to use nginx and add redirect rules --- Dockerfile | 21 ++++++++++----------- nginx.conf | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9cdd8f..e4159be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,17 @@ -FROM alpine:latest +FROM nginx:1.23.3-alpine -# Install thttpd -RUN apk add --no-cache thttpd +# Remove the default Nginx configuration +RUN rm -rf /etc/nginx/conf.d/ -# Create a non-root user to own the files and run our server -RUN adduser -D static -USER static -WORKDIR /home/static +# Copy our Nginx configuration +COPY nginx.conf /etc/nginx/ # Copy the static website # Use the .dockerignore file to control what ends up inside the image! -COPY public . +COPY public /usr/share/nginx/html/ -# Run thttpd -CMD ["thttpd", "-D", "-h", "0.0.0.0", "-p", "3000", "-d", "/home/static", "-u", "static", "-l", "-", "-M", "60"] +# Expose port 80 +EXPOSE 3000 -EXPOSE 3000 \ No newline at end of file +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf index e69de29..f0f92c4 100644 --- a/nginx.conf +++ b/nginx.conf @@ -0,0 +1,46 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + access_log /var/log/nginx/access.log ; + error_log /var/log/nginx/error.log; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + server { + listen 3000; + listen [::]:3000; + + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # error_page + error_page 404 403 500 502 503 504 /assets/page/oops.htm; + + # Rename cheatsheet + rewrite ^/golang$ /go permanent; + + # remove .html extension + location / { + if ($request_uri ~ ^/(.*)\.html) { + return 302 /$1; + } + try_files $uri $uri.html $uri/ =404; + } + } +} From 28b8326003fa10637f6b4136df05338f7a352a80 Mon Sep 17 00:00:00 2001 From: fechin Date: Fri, 10 Mar 2023 09:27:23 +0800 Subject: [PATCH 04/30] Update nginx rewrite rules for removing .html extension --- nginx.conf | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nginx.conf b/nginx.conf index f0f92c4..c1d60b2 100644 --- a/nginx.conf +++ b/nginx.conf @@ -35,12 +35,14 @@ http { # Rename cheatsheet rewrite ^/golang$ /go permanent; - # remove .html extension location / { - if ($request_uri ~ ^/(.*)\.html) { - return 302 /$1; - } - try_files $uri $uri.html $uri/ =404; + try_files $uri $uri/ @html; + } + + location @html { + # remove .html extension + rewrite ^(.*)\.html$ $1 permanent; + try_files $uri.html $uri/ =404; } } } From 717795f04b2de9cc46fc54f64bf142f3418afac3 Mon Sep 17 00:00:00 2001 From: fechin Date: Fri, 10 Mar 2023 09:27:52 +0800 Subject: [PATCH 05/30] Update footer.ejs --- themes/coo/layout/_partial/footer.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/coo/layout/_partial/footer.ejs b/themes/coo/layout/_partial/footer.ejs index 41dcd04..00c3cca 100644 --- a/themes/coo/layout/_partial/footer.ejs +++ b/themes/coo/layout/_partial/footer.ejs @@ -15,7 +15,7 @@