From 96f5a7f2be985785480021125eccc74756aad896 Mon Sep 17 00:00:00 2001 From: Dylan Hillerbrand Date: Thu, 13 Jun 2024 15:44:50 -0400 Subject: [PATCH 1/2] refactor(nginx): change location of custom error pages --- config/nginx/conf.d/cantusdb.conf.development | 16 +++++----------- nginx/Dockerfile | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/config/nginx/conf.d/cantusdb.conf.development b/config/nginx/conf.d/cantusdb.conf.development index 972c91519..25ec86df2 100644 --- a/config/nginx/conf.d/cantusdb.conf.development +++ b/config/nginx/conf.d/cantusdb.conf.development @@ -10,6 +10,7 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; + proxy_intercept_errors on; } location /static { @@ -24,17 +25,10 @@ server { expires modified +24h; } - error_page 500 /500.html; - location = /500.html { - root /; - } - - error_page 502 /502.html; - location = /502.html { - root /; - } - error_page 504 /504.html; - location = /504.html { + error_page 500 /error_pages/500.html; + error_page 502 /error_pages/502.html; + error_page 504 /error_pages/504.html; + location /error_pages { root /; } } diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 080a18815..20a0c1ed2 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -6,5 +6,5 @@ RUN curl -LJO https://github.com/go-acme/lego/releases/download/v4.14.2/lego_v4. mv lego /usr/local/bin/lego && \ rm lego_v4.14.2_linux_amd64.tar.gz RUN mkdir -p /var/www/lego -COPY error_pages . +COPY error_pages /error_pages COPY password/.htpasswd /etc/nginx/.htpasswd \ No newline at end of file From 2c4fb3005c55e3c3c2ab0bf494a826153e3d4676 Mon Sep 17 00:00:00 2001 From: Dylan Hillerbrand Date: Fri, 14 Jun 2024 10:33:01 -0400 Subject: [PATCH 2/2] fix(nginx): remove placeholder .htpasswd file --- nginx/Dockerfile | 3 +-- nginx/password/.htpasswd | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 nginx/password/.htpasswd diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 20a0c1ed2..fa8b1fdb6 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -6,5 +6,4 @@ RUN curl -LJO https://github.com/go-acme/lego/releases/download/v4.14.2/lego_v4. mv lego /usr/local/bin/lego && \ rm lego_v4.14.2_linux_amd64.tar.gz RUN mkdir -p /var/www/lego -COPY error_pages /error_pages -COPY password/.htpasswd /etc/nginx/.htpasswd \ No newline at end of file +COPY error_pages /error_pages \ No newline at end of file diff --git a/nginx/password/.htpasswd b/nginx/password/.htpasswd deleted file mode 100644 index 4453f326c..000000000 --- a/nginx/password/.htpasswd +++ /dev/null @@ -1 +0,0 @@ -# Note: This file is intentionally empty for development and production environments. It will be replaced with a file containing a hashed password on the staging server by ansible. \ No newline at end of file