2
0

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
This commit is contained in:
Kovács Zoltán 2025-02-02 18:26:25 +01:00
parent 0547b81062
commit 125466cf1e
4 changed files with 28 additions and 4 deletions

View File

@ -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
"<span style='font-size: x-large'>Sorry something went wrong. Try again a bit later.<br>
You may report this at <a href='mailto:$server_admin'>$server_admin</a>.</span>";
}
#
# 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 "<span style='font-size: x-large'>Sorry try <a href='$scheme://$server_name/$PAR_LOCATION'>$scheme://$server_name/$PAR_LOCATION</a> instead.</span>";
## 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;

1
configs/.gitignore vendored
View File

@ -1,3 +1,4 @@
# Ignore everything else in this directory.
*
!certs
!.gitignore

3
configs/certs/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Ignore everything else in this directory.
*
!.gitignore

View File

@ -8,6 +8,9 @@
#
# Author: Kovács Zoltán <kovacs.zoltan@smartfront.hu>
# 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"