|
|
@@ -29,20 +29,21 @@ source $VESTA/conf/vesta.conf
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
check_args '3' "$#" 'USER DOMAIN TEMPLATE [RESTART]'
|
|
|
-validate_format 'user' 'domain' 'template'
|
|
|
+is_format_valid 'user' 'domain' 'template'
|
|
|
is_system_enabled "$WEB_BACKEND" 'WEB_BACKEND'
|
|
|
is_object_valid 'user' 'USER' "$user"
|
|
|
is_object_unsuspended 'user' 'USER' "$user"
|
|
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
|
|
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
|
|
is_web_backend_template_valid $template
|
|
|
-is_web_backend_pool_valid
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
# Action #
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
+prepare_web_backend
|
|
|
+
|
|
|
# Deleting backend
|
|
|
rm -f $pool/$backend.conf
|
|
|
|
|
|
@@ -71,34 +72,26 @@ if [ "$backend" = "$user" ]; then
|
|
|
nohead=1
|
|
|
|
|
|
for domain in $(shell_list); do
|
|
|
-
|
|
|
- # Parsing domain values
|
|
|
get_domain_values 'web'
|
|
|
- ip=$(get_real_ip $IP)
|
|
|
-
|
|
|
- # Deleting old vhost
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl"
|
|
|
- conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf"
|
|
|
- del_web_config
|
|
|
+ local_ip=$(get_real_ip $IP)
|
|
|
+ prepare_web_domain_values
|
|
|
|
|
|
- # Deleting old ssl vhost
|
|
|
+ # Rebuilding vhost
|
|
|
+ del_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
|
|
+ add_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
|
|
if [ "$SSL" = 'yes' ]; then
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
|
|
|
- conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
|
|
|
- del_web_config
|
|
|
+ del_web_config "$WEB_SYSTEM" "$TPL.stpl"
|
|
|
+ add_web_config "$WEB_SYSTEM" "$TPL.stpl"
|
|
|
fi
|
|
|
|
|
|
- # Adding new vhost
|
|
|
- upd_web_domain_values
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl"
|
|
|
- conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf"
|
|
|
- add_web_config
|
|
|
-
|
|
|
- # Adding new ssl vhost
|
|
|
- if [ "$SSL" = 'yes' ]; then
|
|
|
- conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
|
|
|
- add_web_config
|
|
|
+ # Rebuilding proxy configuration
|
|
|
+ if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
|
|
|
+ del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
|
|
|
+ add_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
|
|
|
+ if [ "$SSL" = 'yes' ]; then
|
|
|
+ del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
|
|
|
+ add_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
# Update config
|
|
|
@@ -117,31 +110,25 @@ if [ "$backend" = "$user" ]; then
|
|
|
else
|
|
|
# Parsing domain values
|
|
|
get_domain_values 'web'
|
|
|
- ip=$(get_real_ip $IP)
|
|
|
+ local_ip=$(get_real_ip $IP)
|
|
|
+ prepare_web_domain_values
|
|
|
|
|
|
- # Deleting old vhost
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl"
|
|
|
- conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf"
|
|
|
- del_web_config
|
|
|
-
|
|
|
- # Deleting old ssl vhost
|
|
|
+ # Rebuilding vhost
|
|
|
+ del_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
|
|
+ add_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
|
|
if [ "$SSL" = 'yes' ]; then
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
|
|
|
- conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
|
|
|
- del_web_config
|
|
|
+ del_web_config "$WEB_SYSTEM" "$TPL.stpl"
|
|
|
+ add_web_config "$WEB_SYSTEM" "$TPL.stpl"
|
|
|
fi
|
|
|
|
|
|
- # Adding new vhost
|
|
|
- upd_web_domain_values
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl"
|
|
|
- conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf"
|
|
|
- add_web_config
|
|
|
-
|
|
|
- # Adding new ssl vhost
|
|
|
- if [ "$SSL" = 'yes' ]; then
|
|
|
- conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
|
|
|
- tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
|
|
|
- add_web_config
|
|
|
+ # Rebuilding proxy configuration
|
|
|
+ if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
|
|
|
+ del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
|
|
|
+ add_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
|
|
|
+ if [ "$SSL" = 'yes' ]; then
|
|
|
+ del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
|
|
|
+ add_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
# Update config
|
|
|
@@ -166,6 +153,6 @@ fi
|
|
|
|
|
|
# Logging
|
|
|
log_history "changed backend template for $domain to $template"
|
|
|
-log_event "$OK" "$EVENT"
|
|
|
+log_event "$OK" "$ARGUMENTS"
|
|
|
|
|
|
exit
|