diff --git a/type/__recycledcloud_nginx/manifest b/type/__recycledcloud_nginx/manifest index c91ef1a..b9b5c1d 100644 --- a/type/__recycledcloud_nginx/manifest +++ b/type/__recycledcloud_nginx/manifest @@ -6,6 +6,10 @@ case "$os" in nginx_user=nginx 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; exit 1; diff --git a/type/__recycledcloud_nginx_vhost/gencode-remote b/type/__recycledcloud_nginx_vhost/gencode-remote index 985ad16..d634d83 100644 --- a/type/__recycledcloud_nginx_vhost/gencode-remote +++ b/type/__recycledcloud_nginx_vhost/gencode-remote @@ -1,12 +1,23 @@ #!/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. # TODO: only check if configuration was changed (= listen for __file's # messages). cat << EOF if nginx -t; then - service nginx --ifstarted reload - service nginx --ifstopped start + $reload_hook else echo "NGINX configuration is invalid. Exiting." >2& nginx -t >2& diff --git a/type/__recycledcloud_nginx_vhost/manifest b/type/__recycledcloud_nginx_vhost/manifest index d15b957..555ff0f 100644 --- a/type/__recycledcloud_nginx_vhost/manifest +++ b/type/__recycledcloud_nginx_vhost/manifest @@ -23,7 +23,7 @@ os="$(cat "${__global:?}"/explorer/os)" mkdir -p "${__object:?}/files" case "$os" in - "alpine") + alpine) __package nginx nginx_confdir="/etc/nginx" @@ -38,8 +38,20 @@ case "$os" in export NGINX_WEBROOT="/var/www" 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; esac diff --git a/type/__uacme_account/gencode-remote b/type/__uacme_account/gencode-remote index be1599f..e1d9551 100644 --- a/type/__uacme_account/gencode-remote +++ b/type/__uacme_account/gencode-remote @@ -3,7 +3,7 @@ os="$(cat "${__global:?}"/explorer/os)" case "$os" in - 'alpine') + alpine|ubuntu|debian) default_confdir=/etc/ssl/uacme ;; *) diff --git a/type/__uacme_obtain/gencode-remote b/type/__uacme_obtain/gencode-remote index ed0b3e8..10d0644 100644 --- a/type/__uacme_obtain/gencode-remote +++ b/type/__uacme_obtain/gencode-remote @@ -4,7 +4,7 @@ os="$(cat "${__global:?}"/explorer/os)" case "$os" in - alpine) + alpine|ubuntu|debian) default_confdir=/etc/ssl/uacme ;; *) diff --git a/type/__uacme_obtain/manifest b/type/__uacme_obtain/manifest index a6458ca..db4b0ae 100644 --- a/type/__uacme_obtain/manifest +++ b/type/__uacme_obtain/manifest @@ -2,7 +2,7 @@ os="$(cat "${__global:?}"/explorer/os)" case "$os" in - alpine) + alpine|ubuntu|debian) __package uacme default_challengedir=/var/www/.well-known/acme-challenge