1414user=$1
1515domain=$( idn -t --quiet -u " $2 " )
1616domain_idn=$( idn -t --quiet -a " $domain " )
17- template=${3-default}
17+ template=$3
1818default_extentions=" jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,\
1919exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm"
2020extentions=${4-$default_extentions }
@@ -31,14 +31,20 @@ source $VESTA/func/domain.sh
3131# ----------------------------------------------------------#
3232
3333check_args ' 2' " $# " ' user domain [template] [extentions] [restart]'
34- validate_format ' user' ' domain' ' template ' ' extentions'
34+ validate_format ' user' ' domain' ' extentions'
3535is_system_enabled " $PROXY_SYSTEM "
3636is_object_valid ' user' ' USER' " $user "
3737is_object_unsuspended ' user' ' USER' " $user "
3838is_object_valid ' web' ' DOMAIN' " $domain "
3939is_object_unsuspended ' web' ' DOMAIN' " $domain "
4040is_object_value_empty ' web' ' DOMAIN' " $domain " ' $NGINX'
41- is_nginx_template_valid
41+ if [ ! -z " $template " ]; then
42+ validate_format ' template'
43+ is_nginx_template_valid
44+ else
45+ template=$( get_user_value ' $TEMPLATE' )
46+ is_nginx_template_valid
47+ fi
4248
4349
4450# ----------------------------------------------------------#
@@ -49,7 +55,7 @@ is_nginx_template_valid
4955get_domain_values ' web'
5056NGINX=" $template "
5157NGINX_EXT=" $extentions "
52- tpl_file=" $WEBTPL /ngingx_ $NGINX .tpl"
58+ tpl_file=" $WEBTPL /nginx_ $NGINX .tpl"
5359conf=" $HOMEDIR /$user /conf/web/nginx.conf"
5460
5561# Preparing domain values for the template substitution
6975
7076# Checking ssl
7177if [ " $SSL " = ' yes' ]; then
72- tpl_file=" $WEBTPL /ngingx_ $NGINX .stpl"
78+ tpl_file=" $WEBTPL /nginx_ $NGINX .stpl"
7379 conf=" $HOMEDIR /$user /conf/web/snginx.conf"
7480 add_web_config
7581
0 commit comments