diff --git a/bin/v_add_web_domain b/bin/v_add_web_domain index ead30ba91..16ae5c83a 100755 --- a/bin/v_add_web_domain +++ b/bin/v_add_web_domain @@ -81,7 +81,7 @@ else fi # Defining vars for httpd_add_config function -port=$(get_web_port) +port=$(get_config_value '$WEB_PORT') group="$user" email="$user@$domain" docroot="$V_HOME/$user/domains/$domain/public_html" diff --git a/bin/v_add_web_domain_ssl b/bin/v_add_web_domain_ssl index 374443b12..fce101019 100755 --- a/bin/v_add_web_domain_ssl +++ b/bin/v_add_web_domain_ssl @@ -68,7 +68,7 @@ is_template_valid 'web' #----------------------------------------------------------# # Defining variables for template replace -port=$(get_web_port_ssl) +port=$(get_config_value '$WEB_SSL_PORT') aliases=$(get_web_domain_value '$ALIAS') aliases_idn=$(idn -t --quiet -a "$aliases") email="$user@$domain" diff --git a/bin/v_change_web_domain_tpl b/bin/v_change_web_domain_tpl index 18362ef0c..42e7cec60 100755 --- a/bin/v_change_web_domain_tpl +++ b/bin/v_change_web_domain_tpl @@ -73,7 +73,7 @@ fi # Defining variables for template replace ip=$(get_web_domain_value '$IP') aliases=$(get_web_domain_value '$ALIAS') -port=$(get_web_port) +port=$(get_config_value '$WEB_PORT') email="$user@$domain" docroot="$V_HOME/$user/domains/$domain/public_html" conf="$V_HOME/$user/conf/httpd.conf" @@ -91,7 +91,7 @@ fi # Checking ssl if [ "$ssl" = 'yes' ]; then # Defining variables for ssl template replace - port=$(get_web_port_ssl) + port=$(get_config_value '$WEB_SSL_PORT') tpl_option=$(get_web_domain_value '$SSL_HOME') cert=$(get_web_domain_value '$SSL_CERT') ssl_cert="$V_HOME/$user/conf/$cert.crt" diff --git a/bin/v_rebuild_web_domains b/bin/v_rebuild_web_domains index a4e9a6258..1ab8511b7 100755 --- a/bin/v_rebuild_web_domains +++ b/bin/v_rebuild_web_domains @@ -58,7 +58,7 @@ for domain in $domains; do template=$(get_web_domain_value '$TPL') tpl_file="$V_WEBTPL/apache_$template.tpl" ip=$(get_web_domain_value '$IP') - port=$(get_web_port) + port=$(get_config_value '$WEB_PORT') domain=$(get_web_domain_value '$DOMAIN') domain_idn=$(idn -t --quiet -a "$domain") group="$user" @@ -89,6 +89,7 @@ for domain in $domains; do same) docroot="$V_HOME/$user/domains/$domain/public_html" ;; *) check_args '3' "$#" 'user domain certificate [sslhome]' esac + port=$(get_config_value '$WEB_SSL_PORT') # Adding domain to the httpd.conf conf="$V_HOME/$user/conf/tmp_shttpd.conf" diff --git a/conf/vesta.conf b/conf/vesta.conf index 84e9ad93d..d39eaa0eb 100644 --- a/conf/vesta.conf +++ b/conf/vesta.conf @@ -1,6 +1,10 @@ WEB_SYSTEM='apache' WEB_SSL='mod_ssl' +WEB_PORT='8080' +WEB_SSL_PORT='8443' PROXY_SYSTEM='nginx' +PROXY_PORT='80' +PROXY_SSL_PORT='443' FTP_SYSTEM='vsftpd' MAIL_SYSTEM='' DB_SYSTEM='mysql' diff --git a/func/domain_func.sh b/func/domain_func.sh index 386bd4f86..1f989a49a 100644 --- a/func/domain_func.sh +++ b/func/domain_func.sh @@ -219,37 +219,6 @@ sort_dns_records() { mv -f $conf.tmp $conf } -get_web_port() { - proxy_disabled='80' - proxy_enabled='8080' - - # Parsing conf - proxy=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf|cut -f 2 -d \') - - # Checking result - if [ -z "$proxy" ] || [ "$proxy" = 'off' ]; then - echo "$proxy_disabled" - else - echo "$proxy_enabled" - fi -} - -get_web_port_ssl() { - proxy_disabled='443' - proxy_enabled='8443' - - # Parsing conf - proxy=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf|cut -f 2 -d \') - - # Checking result - if [ -z "$proxy" ] || [ "$proxy" = 'off' ]; then - echo "$proxy_disabled" - else - echo "$proxy_enabled" - fi -} - - httpd_add_config() { # Adding template to config cat $tpl_file | \ @@ -266,6 +235,7 @@ httpd_add_config() { -e "s/%alias%/${aliases//,/ }/g" \ -e "s/%ssl_cert%/${ssl_cert////\/}/g" \ -e "s/%ssl_key%/${ssl_key////\/}/g" \ + -e "s/%extentions%/$extentions/g" \ >> $conf } diff --git a/func/shared_func.sh b/func/shared_func.sh index 9473ee16a..6b32a7266 100644 --- a/func/shared_func.sh +++ b/func/shared_func.sh @@ -592,7 +592,7 @@ is_template_valid() { proxy_template() { tpl="$V_WEBTPL/ngingx_vhost_$template.tpl" descr="$V_WEBTPL/ngingx_vhost_$template.descr" - ssl="$V_WEBTPL/ngingx_vhost_$template.ssl.tpl" + ssl="$V_WEBTPL/ngingx_vhost_$template.stpl" if [ ! -e $tpl ] || [ ! -e $descr ] || [ ! -e $ssl ]; then echo "Error: template not found" @@ -1334,3 +1334,20 @@ pkg_shell_list() { i=$(($i + 1)) done } + +get_config_value() { + key="$1" + # Parsing config + string=$(cat $V_CONF/vesta.conf) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Print value + echo "$value" +} \ No newline at end of file