From 33c6e23e7b04d7edcc301732e9bdf7396c5679b2 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:43:46 +0100 Subject: [PATCH] Enhance NGINX Docker setup: add landing page, update configurations, and include static files --- nginx/Dockerfile | 11 ++- nginx/setup/default.conf.template | 15 +-- nginx/setup/html/github.svg | 1 + nginx/setup/html/index.html | 155 ++++++++++++++++++++++++++++++ nginx/setup/{ => html}/robots.txt | 0 nginx/setup/index.html | 22 ----- 6 files changed, 172 insertions(+), 32 deletions(-) create mode 100644 nginx/setup/html/github.svg create mode 100644 nginx/setup/html/index.html rename nginx/setup/{ => html}/robots.txt (100%) delete mode 100644 nginx/setup/index.html diff --git a/nginx/Dockerfile b/nginx/Dockerfile index afca98239..c66209c97 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -13,13 +13,18 @@ ENV PROXY_CKAN_PROXY_PASS=http://${CKAN_COMPOSE_SERVICE}:${CKAN_PORT} ENV NGINX_PORT=80 ENV NGINX_LOG_DIR=/var/log/nginx ENV NGINX_DIR=/etc/nginx +ENV NGINX_SHARE_HTML_DIR=/usr/share/nginx/html -RUN mkdir -p ${NGINX_LOG_DIR} && \ - mkdir -p ${NGINX_DIR}/certs +RUN mkdir -p ${NGINX_LOG_DIR} \ + && mkdir -p ${NGINX_DIR}/certs +# Copy configuration and static files COPY setup/nginx.conf ${NGINX_DIR}/nginx.conf -COPY setup/index.html /usr/share/nginx/html/index.html COPY setup/default.conf.template ${NGINX_DIR}/templates/default.conf.template COPY setup/ckan-local.* ${NGINX_DIR}/certs/ +COPY setup/html/index.html setup/html/robots.txt ${NGINX_SHARE_HTML_DIR}/ + +# Replace $PROXY_CKAN_LOCATION and $PROXY_PYCSW_LOCATION in index.html +RUN sed -i "s|/catalog|${PROXY_CKAN_LOCATION}|g; s|/csw|${PROXY_PYCSW_LOCATION}|g" ${NGINX_SHARE_HTML_DIR}/index.html EXPOSE ${NGINX_PORT} \ No newline at end of file diff --git a/nginx/setup/default.conf.template b/nginx/setup/default.conf.template index d0c21a439..51c7b22e1 100644 --- a/nginx/setup/default.conf.template +++ b/nginx/setup/default.conf.template @@ -7,6 +7,9 @@ server { ssl_certificate /etc/nginx/certs/ckan-local.crt; ssl_certificate_key /etc/nginx/certs/ckan-local.key; + root $NGINX_SHARE_HTML_DIR; + index index.html; + # TLS 1.2 & 1.3 only ssl_protocols TLSv1.2 TLSv1.3; @@ -70,12 +73,10 @@ server { error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 425 426 428 429 431 451 500 501 502 503 504 505 506 507 508 510 511 /error.html; # redirect server error pages to the static page /error.html - # - location = /error.html { - ssi on; - internal; - auth_basic off; - root /usr/share/nginx/html; + + # robots.txt + location = /robots.txt { + add_header Content-Type text/plain; + root $NGINX_SHARE_HTML_DIR; } - } \ No newline at end of file diff --git a/nginx/setup/html/github.svg b/nginx/setup/html/github.svg new file mode 100644 index 000000000..a3ff759d0 --- /dev/null +++ b/nginx/setup/html/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/nginx/setup/html/index.html b/nginx/setup/html/index.html new file mode 100644 index 000000000..c5308a4eb --- /dev/null +++ b/nginx/setup/html/index.html @@ -0,0 +1,155 @@ + + + + + + + CKAN Docker Landing Page + + + +
+

CKAN Docker Landing Page

+
+
+ +
+ + + \ No newline at end of file diff --git a/nginx/setup/robots.txt b/nginx/setup/html/robots.txt similarity index 100% rename from nginx/setup/robots.txt rename to nginx/setup/html/robots.txt diff --git a/nginx/setup/index.html b/nginx/setup/index.html deleted file mode 100644 index 561b63bb6..000000000 --- a/nginx/setup/index.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - CKAN Docker NGINX landing page - - - - -

- CKAN Docker NGINX landing page -

- - - \ No newline at end of file