From 125466cf1e87f757a23c41bdde525022d0ea55d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Zolt=C3=A1n?= Date: Sun, 2 Feb 2025 18:26:25 +0100 Subject: [PATCH] Minor webservice enhancements * forced text/html MIME type to the nginx.conf static messages * preparation of a static web service in nginx.conf * preparation of static certificates in configs folder and nginx.conf * missing } in nginx.conf --- .templates/nginx/nginx.conf | 23 ++++++++++++++++--- configs/.gitignore | 1 + configs/certs/.gitignore | 3 +++ .../startup.d/100-docker-compose-withlogs.sh | 5 +++- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 configs/certs/.gitignore diff --git a/.templates/nginx/nginx.conf b/.templates/nginx/nginx.conf index 2a94ef2..e3ccb24 100644 --- a/.templates/nginx/nginx.conf +++ b/.templates/nginx/nginx.conf @@ -30,8 +30,10 @@ server { # return 301 https://$host$request_uri; # } - # Webapp's configuration. + # Extended character set. charset utf-8; + + # Webapp's configuration. location /$PAR_LOCATION { proxy_pass http://$PAR_PROXYHOST:$PAR_PROXYPORT/$PAR_LOCATION; error_page 500 502 503 504 @proxy_error; @@ -57,18 +59,29 @@ server { proxy_set_header Connection "upgrade"; } location @proxy_error { - default_type text/html; + types { } default_type text/html; return 500 "Sorry something went wrong. Try again a bit later.
You may report this at $server_admin.
"; } + # + # Static service. +# location / { +# root $PAR_SERVICE/storage/volumes/staticweb/; +# allow all; +# autoindex off; +# index index.html index.htm; +# try_files $ri $uri/ =404; +# } + # # No static service, but we may provide the OPTIONS for a potential DAV client. # location / { -# default_type text/html; +# types { } default_type text/html; ## dav_ext_methods OPTIONS; # if ($request_method != OPTIONS) { # return 404 "Sorry try $scheme://$server_name/$PAR_LOCATION instead."; ## return 302 $scheme://$server_name/$PAR_LOCATION; +# } # } ################################################################################## @@ -76,8 +89,12 @@ server { # https://ssl-config.mozilla.org/ # https://community.letsencrypt.org/t/howto-a-with-all-100-s-on-ssl-labs-test-using-nginx-mainline-stable/55033 + # For an ACME-handled certificate. # ssl_certificate $PAR_SERVICE/configs/acme/$PAR_SERVERNAME/fullchain.cer; # ssl_certificate_key $PAR_SERVICE/configs/acme/$PAR_SERVERNAME/$PAR_SERVERNAME.key; + # For a (possibly symlinked) static certificate. +# ssl_certificate $PAR_SERVICE/configs/certs/$PAR_SERVERNAME/fullchain.cer; +# ssl_certificate_key $PAR_SERVICE/configs/certs/$PAR_SERVERNAME/$PAR_SERVERNAME.key; # Settings to achieve 'A' grade on https://www.ssllabs.com/ssltest/ ssl_session_timeout 1440m; diff --git a/configs/.gitignore b/configs/.gitignore index 17cd352..5daa722 100644 --- a/configs/.gitignore +++ b/configs/.gitignore @@ -1,3 +1,4 @@ # Ignore everything else in this directory. * +!certs !.gitignore diff --git a/configs/certs/.gitignore b/configs/certs/.gitignore new file mode 100644 index 0000000..17cd352 --- /dev/null +++ b/configs/certs/.gitignore @@ -0,0 +1,3 @@ +# Ignore everything else in this directory. +* +!.gitignore diff --git a/tools/startup.d/100-docker-compose-withlogs.sh b/tools/startup.d/100-docker-compose-withlogs.sh index e041757..1d06f65 100755 --- a/tools/startup.d/100-docker-compose-withlogs.sh +++ b/tools/startup.d/100-docker-compose-withlogs.sh @@ -8,6 +8,9 @@ # # Author: Kovács Zoltán # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html) +# +# 2025-02-02 v1.2 +# fix: unwanted error message in old docker-compose detection. # 2024-08-24 v1.1 # new: docker-compose v2 compatibility - tested with Ubuntu 24.04 LTS. # 2023-06-18 v1.0 @@ -40,7 +43,7 @@ done # All dependencies are available via "$THECOMMAND" (upper case) call. # # Let's find which version of docker-compose is installed. -if [ $($DOCKER compose version 2>&1 >/dev/null; echo $?) -eq 0 ]; then +if [ $($DOCKER compose version >/dev/null 2>&1; echo $?) -eq 0 ]; then # We'll use v2 if it is available. DOCKER_COMPOSE="$DOCKER" commandstring="compose"