add several configuration vars
This commit is contained in:
parent
3da474274b
commit
637e014b2a
5 changed files with 46 additions and 22 deletions
|
|
@ -47,7 +47,7 @@ fi
|
|||
# WEB_HTTPS_GENERATE_CERTIFICATE="$(form_yes_no -t "$TITLE" -l "Retrieve certificate using LE")"
|
||||
#fi
|
||||
|
||||
DOCUMENT_ROOT="$(form_input -t "$TITLE" -l "Document Root" -d "/var/www/service-web/www/$DOMAIN/web")"
|
||||
DOCUMENT_ROOT="$(form_input -t "$TITLE" -l "Document Root" -d "$WEB_ROOT_PATH/$DOMAIN/web")"
|
||||
|
||||
PHP_ENABLED="$(form_yes_no -t "$TITLE" -l "Support of PHP")"
|
||||
|
||||
|
|
@ -66,7 +66,6 @@ fi
|
|||
USER_PASSWORD="$(tr -dc "0123456789!@#$%()[]*@<>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" < /dev/urandom | head -c 20)"
|
||||
|
||||
SYSTEM_USER_USERNAME="$(form_input -t "$TITLE" -l "System username" -d "web" -r)"
|
||||
SYSTEM_USER_GROUP="webgroup"
|
||||
|
||||
SYSTEM_USER_PASSWORD=$(
|
||||
PASSWORD="$USER_PASSWORD"
|
||||
|
|
@ -92,6 +91,11 @@ export PHP_VERSION
|
|||
export WEB_HTTP
|
||||
export WEB_HTTPS
|
||||
export WEB_HTTPS_FORCE
|
||||
export WEB_ROOT_PATH
|
||||
export WEB_LOG_PATH
|
||||
export WEB_HTTPS_DEFAULT_CERT_PEM
|
||||
export WEB_HTTPS_DEFAULT_CERT_PRIVKEY
|
||||
export WEB_HTTPS_DEFAULT_CERT_CHAIN
|
||||
|
||||
TMP_FILE="/tmp/vhost-add-$(tr -dc "qwertQWERTasdfgASDFGzxcvbZXCVB" < /dev/urandom | head -c 16)"
|
||||
template summary > "$TMP_FILE"
|
||||
|
|
@ -111,9 +115,9 @@ fi
|
|||
# User and directory creation #
|
||||
###############################
|
||||
|
||||
useradd -G "$SYSTEM_USER_GROUP" -s /bin/zsh -m -p "$SYSTEM_USER_PASSWORD" -d "/services/web/www/$DOMAIN" "$SYSTEM_USER_USERNAME" -k /etc/skel/
|
||||
chgrp www-data "/services/web/www/$DOMAIN"
|
||||
chmod o-r "/services/web/www/$DOMAIN"
|
||||
useradd -G "$SYSTEM_USER_GROUP" -s "$DEFAULT_SHELL" -m -p "$SYSTEM_USER_PASSWORD" -d "$WEB_ROOT_PATH/$DOMAIN" "$SYSTEM_USER_USERNAME" -k "$SKEL_PATH"
|
||||
chgrp www-data "$WEB_ROOT_PATH/$DOMAIN"
|
||||
chmod o-r "$WEB_ROOT_PATH/$DOMAIN"
|
||||
|
||||
#######################
|
||||
# Make configurations #
|
||||
|
|
@ -124,17 +128,20 @@ SERVICES_TO_RELOAD="apache2"
|
|||
SYSTEM_USER_ID="$(id -u "$SYSTEM_USER_USERNAME")"
|
||||
PHP_FPM_PORT=$((SYSTEM_USER_ID + 12000))
|
||||
|
||||
export PHP_FPM_PORT
|
||||
|
||||
if [ "$WEB_HTTP" = "yes" ]; then
|
||||
VHOST_FILE_SA="/etc/apache2/sites-available/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
||||
VHOST_FILE_SE="/etc/apache2/sites-enabled/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
||||
VHOST_FILE_SA="$APACHE_VHOST_SITES_AVAILABLE_PATH/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
||||
VHOST_FILE_SE="$APACHE_VHOST_SITES_ENABLED_PATH/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
||||
|
||||
PORT=$WEB_HTTP_PORT template vhost-http > "$VHOST_FILE_SA"
|
||||
|
||||
ln -rs "$VHOST_FILE_SA" "$VHOST_FILE_SE"
|
||||
fi
|
||||
|
||||
if [ "$WEB_HTTPS" = "yes" ]; then
|
||||
VHOST_FILE_SA="/etc/apache2/sites-available/${DOMAIN}.${WEB_HTTPS_PORT}.conf"
|
||||
VHOST_FILE_SE="/etc/apache2/sites-enabled/${DOMAIN}.${WEB_HTTPS_PORT}.conf"
|
||||
VHOST_FILE_SA="$APACHE_VHOST_SITES_AVAILABLE_PATH/${DOMAIN}.${WEB_HTTPS_PORT}.conf"
|
||||
VHOST_FILE_SE="$APACHE_VHOST_SITES_ENABLED_PATH/${DOMAIN}.${WEB_HTTPS_PORT}.conf"
|
||||
|
||||
PORT=$WEB_HTTPS_PORT template vhost-https > "$VHOST_FILE_SA"
|
||||
|
||||
|
|
@ -142,15 +149,13 @@ if [ "$WEB_HTTPS" = "yes" ]; then
|
|||
fi
|
||||
|
||||
if [ "$PHP_ENABLED" = "yes" ]; then
|
||||
if [ "$PHP_VERSION" = "5.6" ]; then
|
||||
SERVICES_TO_RELOAD="$SERVICES_TO_RELOAD php5-fpm"
|
||||
PHP_FPM_FILE="/etc/php5/fpm/pool.d/${SYSTEM_USER_USERNAME}.conf"
|
||||
else
|
||||
SERVICES_TO_RELOAD="$SERVICES_TO_RELOAD php${PHP_VERSION}-fpm"
|
||||
PHP_FPM_FILE="/etc/php/$PHP_VERSION/fpm/pool.d/${SYSTEM_USER_USERNAME}.conf"
|
||||
fi
|
||||
PHP_VERSION_NORMALISED="$(echo "$PHP_VERSION" | tr -dc 1234567890)"
|
||||
|
||||
export PHP_FPM_PORT
|
||||
eval "FPM_POOL_PATH=\$PHP_FPM${PHP_VERSION_NORMALISED}_POOL_PATH"
|
||||
eval "FPM_SERVICE=\$PHP_FPM${PHP_VERSION_NORMALISED}_SERVICE"
|
||||
|
||||
SERVICES_TO_RELOAD="$SERVICES_TO_RELOAD $FPM_SERVICE"
|
||||
PHP_FPM_FILE="$FPM_POOL_PATH/${SYSTEM_USER_USERNAME}.conf"
|
||||
|
||||
template php-fpm > "$PHP_FPM_FILE"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue