28 lines
1.1 KiB
Bash
28 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
PAR_SERVICENAME=
|
|
PAR_PROXYHOST="localhost"
|
|
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_ACMEPORT="8100"
|
|
PAR_SERVICE="$HOME/services/$PAR_SERVICENAME"
|
|
|
|
PARAMETERS='$PAR_ACMEHOST:$PAR_ACMEPORT:$PAR_SERVICE:$PAR_PROXYHOST:$PAR_PROXYPORT:$PAR_SERVERNAME:$PAR_LOCATION:$PAR_WEBMASTER'
|
|
for parameter in $(echo "$PARAMETERS" | tr ":" "\n")
|
|
do export ${parameter:1}; done
|
|
cat "$PAR_SERVICE/.templates/nginx/nginx.conf" | envsubst "$PARAMETERS" \
|
|
> "$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"
|