6
0
Fork 0

Add debian/ubuntu support to __recycledcloud_nginx

This commit is contained in:
Timothée Floure 2020-11-30 08:36:28 +01:00
parent d5370c829b
commit b1aa3aa61d
Signed by: tfloure
GPG key ID: 4502C902C00A1E12
6 changed files with 34 additions and 7 deletions

View file

@ -6,6 +6,10 @@ case "$os" in
nginx_user=nginx nginx_user=nginx
nginx_certdir=/etc/nginx/ssl nginx_certdir=/etc/nginx/ssl
;; ;;
debian|ubuntu)
nginx_user=www-data
nginx_certdir=/etc/nginx/ssl
;;
*) *)
echo "This type does not support $os yet. Aborting." >&2; echo "This type does not support $os yet. Aborting." >&2;
exit 1; exit 1;

View file

@ -1,12 +1,23 @@
#!/bin/sh #!/bin/sh
os="$(cat "${__global:?}"/explorer/os)"
case "$os" in
alpine)
reload_hook="service nginx --ifstopped start;\
service nginx --ifstarted reload"
;;
debian|ubuntu|*)
reload_hook="systemctl reload-or-restart nginx"
;;
esac
# Check configuration and reload if valid. # Check configuration and reload if valid.
# TODO: only check if configuration was changed (= listen for __file's # TODO: only check if configuration was changed (= listen for __file's
# messages). # messages).
cat << EOF cat << EOF
if nginx -t; then if nginx -t; then
service nginx --ifstarted reload $reload_hook
service nginx --ifstopped start
else else
echo "NGINX configuration is invalid. Exiting." >2& echo "NGINX configuration is invalid. Exiting." >2&
nginx -t >2& nginx -t >2&

View file

@ -23,7 +23,7 @@ os="$(cat "${__global:?}"/explorer/os)"
mkdir -p "${__object:?}/files" mkdir -p "${__object:?}/files"
case "$os" in case "$os" in
"alpine") alpine)
__package nginx __package nginx
nginx_confdir="/etc/nginx" nginx_confdir="/etc/nginx"
@ -38,8 +38,20 @@ case "$os" in
export NGINX_WEBROOT="/var/www" export NGINX_WEBROOT="/var/www"
export ACME_CHALLENGE_DIR="$NGINX_WEBROOT/.well-known/acme-challenge/" export ACME_CHALLENGE_DIR="$NGINX_WEBROOT/.well-known/acme-challenge/"
;; ;;
debian|ubuntu)
__package nginx
nginx_confdir="/etc/nginx"
install_reqs="__package/nginx"
export NGINX_SITEDIR="$nginx_confdir/sites-enabled"
export NGINX_CERTDIR="$nginx_confdir/ssl"
export NGINX_SNIPPETSDIR="$nginx_confdir/snippets"
export NGINX_WEBROOT="/var/www"
export ACME_CHALLENGE_DIR="$NGINX_WEBROOT/.well-known/acme-challenge/"
;;
*) *)
echo "__nginx_vhost does not support $os yet. Aborting." >&2; echo "This type does not support $os yet. Aborting." >&2;
exit 1; exit 1;
esac esac

View file

@ -3,7 +3,7 @@
os="$(cat "${__global:?}"/explorer/os)" os="$(cat "${__global:?}"/explorer/os)"
case "$os" in case "$os" in
'alpine') alpine|ubuntu|debian)
default_confdir=/etc/ssl/uacme default_confdir=/etc/ssl/uacme
;; ;;
*) *)

View file

@ -4,7 +4,7 @@
os="$(cat "${__global:?}"/explorer/os)" os="$(cat "${__global:?}"/explorer/os)"
case "$os" in case "$os" in
alpine) alpine|ubuntu|debian)
default_confdir=/etc/ssl/uacme default_confdir=/etc/ssl/uacme
;; ;;
*) *)

View file

@ -2,7 +2,7 @@
os="$(cat "${__global:?}"/explorer/os)" os="$(cat "${__global:?}"/explorer/os)"
case "$os" in case "$os" in
alpine) alpine|ubuntu|debian)
__package uacme __package uacme
default_challengedir=/var/www/.well-known/acme-challenge default_challengedir=/var/www/.well-known/acme-challenge