Minor improvements.
This commit is contained in:
parent
7803630c76
commit
47211a6ea8
@ -2,7 +2,7 @@
|
|||||||
# Uses https://github.com/acmesh-official/acme.sh to manage SSL certificates.
|
# Uses https://github.com/acmesh-official/acme.sh to manage SSL certificates.
|
||||||
|
|
||||||
# Flags the non 2xx or non 3xx (probably error) responses.
|
# Flags the non 2xx or non 3xx (probably error) responses.
|
||||||
map $status $errorlog { ~^[23] 0; default 1; }
|
map $status $errorlog_$PAR_PROXYPORT { ~^[23] 0; default 1; }
|
||||||
|
|
||||||
# Virtualhost's configuration follows.
|
# Virtualhost's configuration follows.
|
||||||
server {
|
server {
|
||||||
@ -12,12 +12,12 @@ server {
|
|||||||
server_name_in_redirect on;
|
server_name_in_redirect on;
|
||||||
server_name $PAR_SERVERNAME;
|
server_name $PAR_SERVERNAME;
|
||||||
|
|
||||||
set $server_admin webmaster@$server_name;
|
set $server_admin $PAR_WEBMASTER;
|
||||||
|
|
||||||
# access log and error log.
|
# access log and error log.
|
||||||
# Any requests getting a non 2xx or non 3xx response will go to the error log as well.
|
# Any requests getting a non 2xx or non 3xx response will go to the error log as well.
|
||||||
access_log $PAR_SERVICE/logs/web/access.log combined;
|
access_log $PAR_SERVICE/logs/web/access.log combined;
|
||||||
access_log $PAR_SERVICE/logs/web/error.log combined if=$errorlog;
|
access_log $PAR_SERVICE/logs/web/error.log combined if=$errorlog_$PAR_PROXYPORT;
|
||||||
|
|
||||||
# Let's Encrypt (acme.sh) support.
|
# Let's Encrypt (acme.sh) support.
|
||||||
location /.well-known/ {
|
location /.well-known/ {
|
||||||
@ -62,11 +62,13 @@ server {
|
|||||||
"<span style='font-size: x-large'>Sorry something went wrong. Try again a bit later.<br>
|
"<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>";
|
You may report this at <a href='mailto:$server_admin'>$server_admin</a>.</span>";
|
||||||
}
|
}
|
||||||
|
# No static service, but we may provide the OPTIONS for a potential DAV client.
|
||||||
# No static service.
|
|
||||||
# location / {
|
# location / {
|
||||||
# default_type text/html;
|
# default_type text/html;
|
||||||
# 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>";
|
## 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;
|
||||||
# }
|
# }
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
# Backups the configuration files of this docker-composed service.
|
# Backups the configuration files of this docker-composed service.
|
||||||
# This is a general purpose worker script, doesn't requires customization.
|
# This is a general purpose worker script, doesn't requires customization.
|
||||||
#
|
#
|
||||||
# Author: Kovács Zoltán <kovacs.zoltan@smartfront.hu>
|
# Author: Kovács Zoltán <kovacsz@marcusconsulting.hu>
|
||||||
# License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html)
|
# License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
# 2024-03-07 v0.2
|
||||||
|
# fix: tar now dereferences the symlinks (if any).
|
||||||
# 2021-09-03 v0.1 Initial release
|
# 2021-09-03 v0.1 Initial release
|
||||||
|
|
||||||
# Accepted environment variables and their defaults.
|
# Accepted environment variables and their defaults.
|
||||||
@ -69,7 +71,7 @@ BACKUPDIR="${PAR_BACKUPDIR:-$BASE_DIR/$BACKUPDIR}"
|
|||||||
if [ -w "$BACKUPDIR" ]; then
|
if [ -w "$BACKUPDIR" ]; then
|
||||||
BACKUP_NAME="configs.$("$DATE" '+%Y%m%d_%H%M%S').$("$HOSTNAME")"
|
BACKUP_NAME="configs.$("$DATE" '+%Y%m%d_%H%M%S').$("$HOSTNAME")"
|
||||||
( cd "$BASE_DIR"
|
( cd "$BASE_DIR"
|
||||||
"$TAR" czf "$BACKUPDIR/$BACKUP_NAME.tgz" \
|
"$TAR" czhf "$BACKUPDIR/$BACKUP_NAME.tgz" \
|
||||||
"$YMLFILE" configs docker \
|
"$YMLFILE" configs docker \
|
||||||
2>>"$BACKUPDIR/$BACKUP_NAME.log"
|
2>>"$BACKUPDIR/$BACKUP_NAME.log"
|
||||||
)
|
)
|
||||||
|
@ -1,20 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
|
||||||
# Set the variables below then run this script to generate the config/nginx.conf
|
PAR_SERVICENAME=
|
||||||
# (the webserver configuration file for this service). Take a revision then
|
PAR_PROXYHOST="localhost"
|
||||||
# symlink it into the instances/.nginx folder and reload the webserver to activate.
|
PAR_PROXYPORT="8201"
|
||||||
|
PAR_SERVERNAME="myservice.example.com"
|
||||||
|
PAR_LOCATION=
|
||||||
|
PAR_WEBMASTER="webmaster@example.com" # Valid support email address
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# There is nothing to change below this line (I hope)
|
||||||
|
################################################################################
|
||||||
|
|
||||||
PAR_ACMEHOST="localhost"
|
PAR_ACMEHOST="localhost"
|
||||||
PAR_ACMEPORT="8100"
|
PAR_ACMEPORT="8100"
|
||||||
PAR_SERVICE="$HOME/services/servicename"
|
PAR_SERVICE="$HOME/services/$PAR_SERVICENAME"
|
||||||
PAR_PROXYHOST="localhost"
|
|
||||||
PAR_PROXYPORT="8201"
|
|
||||||
PAR_SERVERNAME="www.example.com"
|
|
||||||
PAR_LOCATION=""
|
|
||||||
|
|
||||||
# Do not change anything below.
|
PARAMETERS='$PAR_ACMEHOST:$PAR_ACMEPORT:$PAR_SERVICE:$PAR_PROXYHOST:$PAR_PROXYPORT:$PAR_SERVERNAME:$PAR_LOCATION:$PAR_WEBMASTER'
|
||||||
PARAMETERS='$PAR_ACMEHOST:$PAR_ACMEPORT:$PAR_SERVICE:$PAR_PROXYHOST:$PAR_PROXYPORT:$PAR_SERVERNAME:$PAR_LOCATION'
|
|
||||||
for parameter in $(echo "$PARAMETERS" | tr ":" "\n")
|
for parameter in $(echo "$PARAMETERS" | tr ":" "\n")
|
||||||
do export ${parameter:1}; done
|
do export ${parameter:1}; done
|
||||||
cat "$PAR_SERVICE/.templates/nginx/nginx.conf" | envsubst "$PARAMETERS" \
|
cat "$PAR_SERVICE/.templates/nginx/nginx.conf" | envsubst "$PARAMETERS" \
|
||||||
> "$PAR_SERVICE/configs/nginx.conf"
|
> "$PAR_SERVICE/configs/nginx.conf"
|
||||||
|
|
||||||
|
touch $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log
|
||||||
|
chmod 660 $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log
|
||||||
|
[[ ! -a "$PAR_SERVICE/../.nginx/$PAR_SERVICENAME.conf" ]] \
|
||||||
|
&& ln -s "../$PAR_SERVICENAME/configs/nginx.conf" "$PAR_SERVICE/../.nginx/$PAR_SERVICENAME.conf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user