diff --git a/bin/v_add_web_domain b/bin/v_add_web_domain index 8cebcce5a..432e02572 100755 --- a/bin/v_add_web_domain +++ b/bin/v_add_web_domain @@ -72,7 +72,6 @@ fi group="$user" email="$user@$domain" docroot="$HOMEDIR/$user/web/$domain/public_html" -docroot_string="DocumentRoot $docroot" conf="$HOMEDIR/$user/conf/web/httpd.conf" tpl_file="$WEBTPL/apache_$template.tpl" diff --git a/bin/v_add_web_domain_alias b/bin/v_add_web_domain_alias index 9cebb33fd..5a5c695aa 100755 --- a/bin/v_add_web_domain_alias +++ b/bin/v_add_web_domain_alias @@ -73,14 +73,13 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config add_web_config diff --git a/bin/v_add_web_domain_elog b/bin/v_add_web_domain_elog index 91d1c1898..d1a72f730 100755 --- a/bin/v_add_web_domain_elog +++ b/bin/v_add_web_domain_elog @@ -66,14 +66,13 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config add_web_config diff --git a/bin/v_add_web_domain_nginx b/bin/v_add_web_domain_nginx index 570db0fec..df4ad3674 100755 --- a/bin/v_add_web_domain_nginx +++ b/bin/v_add_web_domain_nginx @@ -49,7 +49,7 @@ is_nginx_template_valid get_domain_values 'web' NGINX="$template" NGINX_EXT="$extentions" -tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" +tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" # Preparing domain values for the template substitution @@ -69,8 +69,7 @@ fi # Checking ssl if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" add_web_config diff --git a/bin/v_add_web_domain_ssl b/bin/v_add_web_domain_ssl index def7ffc0f..b42ae06c9 100755 --- a/bin/v_add_web_domain_ssl +++ b/bin/v_add_web_domain_ssl @@ -84,7 +84,7 @@ fi # Running template trigger if [ -x $WEBTPL/apache_$template.sh ]; then - $WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot + $WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $sdocroot fi # Checking main vesta httpd config @@ -98,7 +98,7 @@ fi if [ ! -z "$NGINX" ]; then # Adding domain to the snginx.conf conf="$HOMEDIR/$user/conf/web/snginx.conf" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" add_web_config chown root:nginx $conf diff --git a/bin/v_backup_user b/bin/v_backup_user index 91c4417e3..1593d3b9b 100755 --- a/bin/v_backup_user +++ b/bin/v_backup_user @@ -163,14 +163,14 @@ then # Nginx config if [ ! -z "$NGINX" ] ; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" get_web_config_brds sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf # SSL check if [ "$SSL" = 'yes' ] ; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" get_web_config_brds sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf diff --git a/bin/v_change_web_domain_ip b/bin/v_change_web_domain_ip index 9174b8b61..6b56cd56b 100755 --- a/bin/v_change_web_domain_ip +++ b/bin/v_change_web_domain_ip @@ -60,14 +60,14 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" replace_web_config fi # Checking nginx if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" replace_web_config fi diff --git a/bin/v_change_web_domain_nginx_tpl b/bin/v_change_web_domain_nginx_tpl index b93f1c98d..0764c28b7 100755 --- a/bin/v_change_web_domain_nginx_tpl +++ b/bin/v_change_web_domain_nginx_tpl @@ -48,7 +48,7 @@ is_nginx_template_valid # Parsing domain values get_domain_values 'web' -tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" +tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" # Delete old vhost @@ -56,7 +56,7 @@ del_web_config # Checking ssl if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config fi @@ -64,7 +64,7 @@ fi # Add new vhost NGINX="$template" NGINX_EXT="$extentions" -tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" +tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" upd_web_domain_values add_web_config @@ -73,8 +73,7 @@ chmod 640 $conf # Checking ssl if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" add_web_config chown root:nginx $conf diff --git a/bin/v_change_web_domain_sslhome b/bin/v_change_web_domain_sslhome index e30aa4724..e68908c71 100755 --- a/bin/v_change_web_domain_sslhome +++ b/bin/v_change_web_domain_sslhome @@ -56,7 +56,7 @@ replace_web_config # Checking nginx config if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web//snginx.conf" replace_web_config fi diff --git a/bin/v_change_web_domain_tpl b/bin/v_change_web_domain_tpl index 5f42b5416..8c9be97c8 100755 --- a/bin/v_change_web_domain_tpl +++ b/bin/v_change_web_domain_tpl @@ -58,55 +58,9 @@ if [ "$SSL" = 'yes' ]; then fi # Defining variables for new vhost config -ip=$IP -email="$user@$domain" -group="$user" -docroot="$HOMEDIR/$user/web/$domain/public_html" -docroot_string="DocumentRoot $docroot" -conf="$HOMEDIR/$user/conf/web/httpd.conf" +upd_web_domain_values tpl_file="$WEBTPL/apache_$template.tpl" - -# Parsing domain aliases -i=1 -j=1 -OLD_IFS="$IFS" -IFS=',' -for dom_alias in $ALIAS; do - dom_alias=$(idn -t --quiet -a $dom_alias) - - # Spliting ServerAlias lines - check_8k="$server_alias $dom_alias" - if [ "${#check_8k}" -ge '8100' ]; then - if [ "$j" -eq 1 ]; then - alias_string="ServerAlias $server_alias" - else - alias_string="$alias_string\n ServerAlias $server_alias" - fi - (( ++j)) - server_alias='' - fi - - if [ "$i" -eq 1 ]; then - aliases_idn="$dom_alias" - server_alias="$dom_alias" - alias_string="ServerAlias $server_alias" - else - aliases_idn="$aliases_idn,$dom_alias" - server_alias="$server_alias $dom_alias" - fi - (( ++i)) -done -if [ -z "$alias_string" ]; then - alias_string="ServerAlias $server_alias" -else - if [ ! -z "$server_alias" ]; then - alias_string="$alias_string\n ServerAlias $server_alias" - fi -fi -IFS=$OLD_IFS - - # Parsing new template template_data=$(cat $WEBTPL/apache_$template.descr | grep -v '#') for keys in $template_data; do @@ -130,28 +84,15 @@ fi # Checking ssl if [ "$SSL" = 'yes' ]; then - # Defining SSL vars - ssl_crt="$HOMEDIR/$user/conf/web/ssl.$domain.crt" - ssl_key="$HOMEDIR/$user/conf/web/ssl.$domain.key" - ssl_pem="$HOMEDIR/$user/conf/web/ssl.$domain.pem" - ssl_ca="$HOMEDIR/$user/conf/web/ssl.$domain.ca" - if [ ! -e "$USER_DATA/web/ssl/$domain.ca" ]; then - ssl_ca_str='#' - fi - case $SSL_HOME in - single) docroot="$HOMEDIR/$user/web/$domain/public_shtml" ;; - same) docroot="$HOMEDIR/$user/web/$domain/public_html" ;; - esac conf="$HOMEDIR/$user/conf/web/shttpd.conf" tpl_file="$WEBTPL/apache_$template.stpl" - # Adding domain to the httpd.conf add_web_config # Running template trigger if [ -x $WEBTPL/apache_$template.sh ]; then $WEBTPL/apache_$template.sh \ - "$user" "$domain" "$ip" "$HOMEDIR" "$docroot" + "$user" "$domain" "$ip" "$HOMEDIR" "$sdocroot" fi fi diff --git a/bin/v_delete_web_domain b/bin/v_delete_web_domain index c6c32fc12..2e80932e6 100755 --- a/bin/v_delete_web_domain +++ b/bin/v_delete_web_domain @@ -70,13 +70,12 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config fi diff --git a/bin/v_delete_web_domain_alias b/bin/v_delete_web_domain_alias index b6ef843d9..fe18ffe24 100755 --- a/bin/v_delete_web_domain_alias +++ b/bin/v_delete_web_domain_alias @@ -72,14 +72,13 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config add_web_config diff --git a/bin/v_delete_web_domain_elog b/bin/v_delete_web_domain_elog index 9b4acd160..48b89d473 100755 --- a/bin/v_delete_web_domain_elog +++ b/bin/v_delete_web_domain_elog @@ -64,14 +64,13 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config add_web_config diff --git a/bin/v_delete_web_domain_nginx b/bin/v_delete_web_domain_nginx index b33fdc6ee..c4122ac69 100755 --- a/bin/v_delete_web_domain_nginx +++ b/bin/v_delete_web_domain_nginx @@ -41,13 +41,13 @@ is_object_value_exist 'web' 'DOMAIN' "$domain" '$NGINX' # Defining domain parameters get_domain_values 'web' -tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" +tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config # Checking ssl if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config fi diff --git a/bin/v_delete_web_domain_ssl b/bin/v_delete_web_domain_ssl index c6a739ad8..78df805be 100755 --- a/bin/v_delete_web_domain_ssl +++ b/bin/v_delete_web_domain_ssl @@ -49,7 +49,7 @@ del_web_config # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config fi diff --git a/bin/v_list_web_templates_nginx b/bin/v_list_web_templates_nginx index b9389de33..2b0d68c3f 100755 --- a/bin/v_list_web_templates_nginx +++ b/bin/v_list_web_templates_nginx @@ -21,8 +21,8 @@ json_list_wtpl() { i='1' # iterator echo '{' for template in $(echo "$templates" |sed -e "s/,/\n/g"); do - if [ -e "$WEBTPL/ngingx_vhost_$template.descr" ]; then - descr=$(cat $WEBTPL/ngingx_vhost_$template.descr | grep '#'|\ + if [ -e "$WEBTPL/ngingx_$template.descr" ]; then + descr=$(cat $WEBTPL/ngingx_$template.descr | grep '#'|\ sed -e ':a;N;$!ba;s/\n/ /g') if [ $i -ne 1 ]; then echo -e "\t}," @@ -42,8 +42,8 @@ json_list_wtpl() { # Shell function shell_list_wtpl() { for template in $(echo "$templates" |sed -e "s/,/\n/g"); do - if [ -e "$WEBTPL/ngingx_vhost_$template.descr" ]; then - tpl_descr=$(cat $WEBTPL/ngingx_vhost_$template.descr |grep '#') + if [ -e "$WEBTPL/ngingx_$template.descr" ]; then + tpl_descr=$(cat $WEBTPL/ngingx_$template.descr |grep '#') if [ -z "$nohead" ]; then echo "----------" fi diff --git a/bin/v_rebuild_web_domains b/bin/v_rebuild_web_domains index ab2da5afa..cc23726fd 100755 --- a/bin/v_rebuild_web_domains +++ b/bin/v_rebuild_web_domains @@ -18,14 +18,13 @@ source $VESTA/func/main.sh source $VESTA/func/domain.sh source $VESTA/func/ip.sh -url=${2-$SUSPEND_URL} #----------------------------------------------------------# # Verifications # #----------------------------------------------------------# -check_args '1' "$#" 'user [suspend_url]' -validate_format 'user' 'url' +check_args '1' "$#" 'user' +validate_format 'user' is_system_enabled "$WEB_SYSTEM" is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -177,7 +176,7 @@ for domain in $(shell_list) ; do # Running template trigger if [ -x $WEBTPL/apache_$TPL.sh ]; then - $WEBTPL/apache_$TPL.sh $user $domain $ip $HOMEDIR $docroot + $WEBTPL/apache_$TPL.sh $user $domain $ip $HOMEDIR $sdocroot fi user_ssl=$((user_ssl + 1)) @@ -186,20 +185,14 @@ for domain in $(shell_list) ; do # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/tmp_nginx.conf" add_web_config chown root:nginx $conf chmod 640 $conf if [ "$SSL" = 'yes' ]; then - if [ "$SUSPENDED" = 'yes' ]; then - proxy_string="rewrite ^(.*)\$ http://$url;" - else - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - fi - - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/tmp_snginx.conf" add_web_config chown root:nginx $conf diff --git a/bin/v_suspend_web_domain b/bin/v_suspend_web_domain index 035f4a89d..49b8c21de 100755 --- a/bin/v_suspend_web_domain +++ b/bin/v_suspend_web_domain @@ -15,22 +15,21 @@ user=$1 domain=$(idn -t --quiet -u "$2" ) domain_idn=$(idn -t --quiet -a "$domain") +restart=$3 # Includes source $VESTA/conf/vesta.conf source $VESTA/func/main.sh source $VESTA/func/domain.sh -url="${3-$SUSPEND_URL}" -restart=$4 #----------------------------------------------------------# # Verifications # #----------------------------------------------------------# -check_args '2' "$#" 'user domain [suspend_url]' -validate_format 'user' 'domain' 'url' +check_args '2' "$#" 'user domain [restart]' +validate_format 'user' 'domain' is_system_enabled "$WEB_SYSTEM" is_object_valid 'user' 'USER' "$user" is_object_valid 'web' 'DOMAIN' "$domain" @@ -64,14 +63,13 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - proxy_string="rewrite ^(.*)\$ http://$url;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config add_web_config diff --git a/bin/v_suspend_web_domains b/bin/v_suspend_web_domains index dbbe163dc..d287dbfe5 100755 --- a/bin/v_suspend_web_domains +++ b/bin/v_suspend_web_domains @@ -17,9 +17,6 @@ source $VESTA/conf/vesta.conf source $VESTA/func/main.sh source $VESTA/func/domain.sh -# Defining url -url="${2-$SUSPEND_URL}" - #----------------------------------------------------------# # Verifications # diff --git a/bin/v_unsuspend_web_domain b/bin/v_unsuspend_web_domain index c77c58db8..98c83bac5 100755 --- a/bin/v_unsuspend_web_domain +++ b/bin/v_unsuspend_web_domain @@ -25,7 +25,7 @@ source $VESTA/func/domain.sh # Verifications # #----------------------------------------------------------# -check_args '2' "$#" 'user domain' +check_args '2' "$#" 'user domain [restart]' validate_format 'user' 'domain' is_system_enabled "$WEB_SYSTEM" is_object_valid 'user' 'USER' "$user" @@ -60,14 +60,13 @@ fi # Checking nginx if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl" + tpl_file="$WEBTPL/ngingx_$NGINX.tpl" conf="$HOMEDIR/$user/conf/web/nginx.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" - tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl" + tpl_file="$WEBTPL/ngingx_$NGINX.stpl" conf="$HOMEDIR/$user/conf/web/snginx.conf" del_web_config add_web_config diff --git a/data/templates/web/apache_default.stpl b/data/templates/web/apache_default.stpl index 02916c791..82b7cfdd7 100644 --- a/data/templates/web/apache_default.stpl +++ b/data/templates/web/apache_default.stpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %sdocroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ @@ -11,7 +11,7 @@ CustomLog /var/log/httpd/domains/%domain%.bytes bytes CustomLog /var/log/httpd/domains/%domain%.log combined %elog%ErrorLog /var/log/httpd/domains/%domain%.error.log - + AllowOverride AuthConfig FileInfo Indexes Limit SSLRequireSSL Options +Includes -Indexes %cgi_option% diff --git a/data/templates/web/apache_default.tpl b/data/templates/web/apache_default.tpl index d91bc3219..4f972a4e7 100644 --- a/data/templates/web/apache_default.tpl +++ b/data/templates/web/apache_default.tpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %docroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ diff --git a/data/templates/web/apache_phpcgi.stpl b/data/templates/web/apache_phpcgi.stpl index 9664b0408..8201bc3e5 100644 --- a/data/templates/web/apache_phpcgi.stpl +++ b/data/templates/web/apache_phpcgi.stpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %sdocroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ @@ -11,7 +11,7 @@ CustomLog /var/log/httpd/domains/%domain%.bytes bytes CustomLog /var/log/httpd/domains/%domain%.log combined %elog%ErrorLog /var/log/httpd/domains/%domain%.error.log - + AllowOverride AuthConfig FileInfo Indexes Limit SSLRequireSSL Options +Includes -Indexes %cgi_option% diff --git a/data/templates/web/apache_phpcgi.tpl b/data/templates/web/apache_phpcgi.tpl index 967840838..b9b34c8b1 100644 --- a/data/templates/web/apache_phpcgi.tpl +++ b/data/templates/web/apache_phpcgi.tpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %docroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ diff --git a/data/templates/web/apache_phpfcgid.stpl b/data/templates/web/apache_phpfcgid.stpl index 6fe5b6e9b..4cdf25d45 100644 --- a/data/templates/web/apache_phpfcgid.stpl +++ b/data/templates/web/apache_phpfcgid.stpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %sdocroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ @@ -11,7 +11,7 @@ CustomLog /var/log/httpd/domains/%domain%.bytes bytes CustomLog /var/log/httpd/domains/%domain%.log combined %elog%ErrorLog /var/log/httpd/domains/%domain%.error.log - + AllowOverride AuthConfig FileInfo Indexes Limit SSLRequireSSL Options +Includes -Indexes %cgi_option% diff --git a/data/templates/web/apache_phpfcgid.tpl b/data/templates/web/apache_phpfcgid.tpl index 617c70cf1..0bae204dc 100644 --- a/data/templates/web/apache_phpfcgid.tpl +++ b/data/templates/web/apache_phpfcgid.tpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %docroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ diff --git a/data/templates/web/apache_unlim.stpl b/data/templates/web/apache_unlim.stpl index 50f6f916f..a461b4c78 100644 --- a/data/templates/web/apache_unlim.stpl +++ b/data/templates/web/apache_unlim.stpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %sdocroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ @@ -11,7 +11,7 @@ CustomLog /var/log/httpd/domains/%domain%.bytes bytes CustomLog /var/log/httpd/domains/%domain%.log combined %elog%ErrorLog /var/log/httpd/domains/%domain%.error.log - + AllowOverride All SSLRequireSSL Options +Includes -Indexes %cgi_option% diff --git a/data/templates/web/apache_unlim.tpl b/data/templates/web/apache_unlim.tpl index 20abb847c..db2fa53b5 100644 --- a/data/templates/web/apache_unlim.tpl +++ b/data/templates/web/apache_unlim.tpl @@ -3,7 +3,7 @@ ServerName %domain_idn% %alias_string% ServerAdmin %email% - %docroot_string% + DocumentRoot %docroot% %cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ Alias /vstats/ %home%/%user%/web/%domain%/stats/ Alias /error/ %home%/%user%/web/%domain%/document_errors/ diff --git a/data/templates/web/ngingx_ip.tpl b/data/templates/web/ngingx.ip.tpl similarity index 76% rename from data/templates/web/ngingx_ip.tpl rename to data/templates/web/ngingx.ip.tpl index 37b733967..ae1956173 100644 --- a/data/templates/web/ngingx_ip.tpl +++ b/data/templates/web/ngingx.ip.tpl @@ -3,7 +3,7 @@ server { server_name _; #access_log /var/log/nginx/%ip%.log main; location / { - proxy_pass http://%ip%:%web_port%; + proxy_pass http://%ip%:%web_port%; } } diff --git a/data/templates/web/ngingx_vhost_default.descr b/data/templates/web/ngingx_default.descr similarity index 100% rename from data/templates/web/ngingx_vhost_default.descr rename to data/templates/web/ngingx_default.descr diff --git a/data/templates/web/ngingx_vhost_default.stpl b/data/templates/web/ngingx_default.stpl similarity index 91% rename from data/templates/web/ngingx_vhost_default.stpl rename to data/templates/web/ngingx_default.stpl index f4696294a..2af431341 100644 --- a/data/templates/web/ngingx_vhost_default.stpl +++ b/data/templates/web/ngingx_default.stpl @@ -7,9 +7,9 @@ server { %elog%error_log /var/log/httpd/domains/%domain%.error.log error; location / { - %proxy_string% + proxy_pass https://%ip%:%web_ssl_port%; location ~* ^.+\.(%nginx_extentions%)$ { - root %docroot%; + root %sdocroot%; access_log /var/log/httpd/domains/%domain%.log combined; access_log /var/log/httpd/domains/%domain%.bytes bytes; expires max; diff --git a/data/templates/web/ngingx_vhost_default.tpl b/data/templates/web/ngingx_default.tpl similarity index 95% rename from data/templates/web/ngingx_vhost_default.tpl rename to data/templates/web/ngingx_default.tpl index 2646c3115..a3535419a 100644 --- a/data/templates/web/ngingx_vhost_default.tpl +++ b/data/templates/web/ngingx_default.tpl @@ -4,7 +4,7 @@ server { %elog%error_log /var/log/httpd/domains/%domain%.error.log error; location / { - %proxy_string% + proxy_pass http://%ip%:%web_port%; location ~* ^.+\.(%nginx_extentions%)$ { root %docroot%; access_log /var/log/httpd/domains/%domain%.log combined; diff --git a/func/domain.sh b/func/domain.sh index cf7e55015..22b2f463c 100644 --- a/func/domain.sh +++ b/func/domain.sh @@ -13,9 +13,9 @@ is_apache_template_valid() { # Nginx template check is_nginx_template_valid() { - t="$WEBTPL/ngingx_vhost_$template.tpl" - d="$WEBTPL/ngingx_vhost_$template.descr" - s="$WEBTPL/ngingx_vhost_$template.stpl" + t="$WEBTPL/ngingx_$template.tpl" + d="$WEBTPL/ngingx_$template.descr" + s="$WEBTPL/ngingx_$template.stpl" if [ ! -e $t ] || [ ! -e $d ] || [ ! -e $s ]; then echo "Error: nginx $template not found" log_event "$E_NOTEXIST" "$EVENT" @@ -142,7 +142,6 @@ add_web_config() { sed -e "s/%ip%/$ip/g" \ -e "s/%web_port%/$WEB_PORT/g" \ -e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \ - -e "s/%proxy_string%/${proxy_string////\/}/g" \ -e "s/%proxy_port%/$PROXY_PORT/g" \ -e "s/%proxy_ssl_port%/$PROXY_SSL_PORT/g" \ -e "s/%domain_idn%/$domain_idn/g" \ @@ -151,7 +150,7 @@ add_web_config() { -e "s/%group%/$group/g" \ -e "s/%home%/${HOMEDIR////\/}/g" \ -e "s/%docroot%/${docroot////\/}/g" \ - -e "s/%docroot_string%/${docroot_string////\/}/g" \ + -e "s/%sdocroot%/${sdocroot////\/}/g" \ -e "s/%email%/$email/g" \ -e "s/%alias_string%/$alias_string/g" \ -e "s/%alias_idn%/${aliases_idn//,/ }/g" \ @@ -305,7 +304,7 @@ namehost_ip_support() { sed -i "$conf_ins i Listen $ip:$WEB_PORT" $conf if [ "$PROXY_SYSTEM" = 'nginx' ]; then - cat $WEBTPL/ngingx_ip.tpl | sed -e "s/%ip%/$ip/g" \ + cat $WEBTPL/ngingx.ip.tpl | sed -e "s/%ip%/$ip/g" \ -e "s/%web_port%/$WEB_PORT/g" \ -e "s/%proxy_port%/$PROXY_PORT/g" >>$nconf @@ -323,8 +322,8 @@ namehost_ip_disable() { sed -i "/Listen $ip:/d" $conf if [ "$PROXY_SYSTEM" = 'nginx' ]; then - tpl_ln=$(wc -l $WEBTPL/ngingx_ip.tpl | cut -f 1 -d ' ') - ip_line=$(grep -n "%ip%" $WEBTPL/ngingx_ip.tpl |head -n1 |\ + tpl_ln=$(wc -l $WEBTPL/ngingx.ip.tpl | cut -f 1 -d ' ') + ip_line=$(grep -n "%ip%" $WEBTPL/ngingx.ip.tpl |head -n1 |\ cut -f 1 -d :) conf_line=$(grep -n -w $ip $nconf|head -n1|cut -f 1 -d :) if [ -z "$tpl_ln" ] || [ -z "$ip_line" ] || [ -z "$conf_line" ] @@ -357,8 +356,9 @@ upd_web_domain_values() { group="$user" email="$user@$domain" docroot="$HOMEDIR/$user/web/$domain/public_html" - docroot_string="DocumentRoot $docroot" - proxy_string="proxy_pass http://$ip:$WEB_PORT;" + if [ "$SSL_HOME" = 'single' ]; then + sdocroot="$HOMEDIR/$user/web/$domain/public_shtml" ; + fi i=1 j=1 @@ -410,11 +410,6 @@ upd_web_domain_values() { cgi_option='+ExecCGI' fi - if [ "$SUSPENDED" = 'yes' ]; then - docroot_string="Redirect / http://$url" - proxy_string="rewrite ^(.*)\$ http://$url;" - fi - ssl_crt="$HOMEDIR/$user/conf/web/ssl.$domain.crt" ssl_key="$HOMEDIR/$user/conf/web/ssl.$domain.key" ssl_pem="$HOMEDIR/$user/conf/web/ssl.$domain.pem" @@ -423,9 +418,9 @@ upd_web_domain_values() { ssl_ca_str='#' fi - case $SSL_HOME in - single) docroot="$HOMEDIR/$user/web/$domain/public_shtml" ;; - same) docroot="$HOMEDIR/$user/web/$domain/public_html" ;; - esac + if [ "$SUSPENDED" = 'yes' ]; then + docroot="$VESTA/data/templates/web/suspend" + sdocroot="$VESTA/data/templates/web/suspend" + fi } diff --git a/func/main.sh b/func/main.sh index a37d2edd2..6cdc25bc1 100644 --- a/func/main.sh +++ b/func/main.sh @@ -457,17 +457,6 @@ sync_cron_jobs() { ### Format Validators ### -# URL -validate_format_url() { - check_http=$(echo "$1" | grep "^http://" ) - needed_chars=$(echo "$1" | cut -f 2 -d \.) - if [ -z "$check_http" ] || [ -z "$needed_chars" ]; then - echo "Error: url $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - # Shell validate_format_shell() { if [ -z "$(grep -w $1 /etc/shells)" ]; then @@ -753,7 +742,6 @@ validate_format(){ stats_user) validate_format_username "$arg" "$arg_name" ;; template) validate_format_username "$arg" "$arg_name" ;; ttl) validate_format_int "$arg" ;; - url) validate_format_url "$arg" ;; user) validate_format_username "$arg" ;; wday) validate_format_mhdmw "$arg" $arg_name ;; esac