diff --git a/bin/v-add-dns-domain b/bin/v-add-dns-domain index 060a7103a..d361be916 100755 --- a/bin/v-add-dns-domain +++ b/bin/v-add-dns-domain @@ -1,6 +1,6 @@ #!/bin/bash # info: add dns domain -# options: USER DOMAIN IP [TEMPLATE] [NS1] [NS2] [NS3] [NS4] [RESTART] +# options: USER DOMAIN IP [NS1] [NS2] [NS3] [NS4] [RESTART] # # The function adds DNS zone with records defined in the template. If the exp # argument isn't stated, the expiration date value will be set to next year. @@ -20,12 +20,11 @@ domain=$(echo $domain | sed -e 's/\.*$//g' -e 's/^\.*//g') domain=$(echo $domain | tr '[:upper:]' '[:lower:]') domain_idn=$(idn -t --quiet -a "$domain") ip=$3 -template=$4 -ns1=$5 -ns2=$6 -ns3=$7 -ns4=$8 -restart=$9 +ns1=$4 +ns2=$5 +ns3=$6 +ns4=$7 +restart=$8 # Includes source $VESTA/conf/vesta.conf @@ -37,36 +36,32 @@ source $VESTA/func/domain.sh # Verifications # #----------------------------------------------------------# -check_args '3' "$#" 'USER DOMAIN IP [TEMPLATE] [NS1] [NS2] [NS3] [NS4]' +check_args '3' "$#" 'USER DOMAIN IP [NS1] [NS2] [NS3] [NS4]' validate_format 'user' 'domain' 'ip' is_system_enabled "$DNS_SYSTEM" is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_domain_new 'dns' is_package_full 'DNS_DOMAINS' -if [ ! -z "$template" ]; then - validate_format 'template' - is_dns_template_valid -else - template=$(get_user_value '$TEMPLATE') - is_dns_template_valid -fi + +template=$(get_user_value '$DNS_TEMPLATE') +is_dns_template_valid if [ ! -z "$ns1" ]; then - ns1=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g') + ns1=$(echo $4 | sed -e 's/\.*$//g' -e 's/^\.*//g') validate_format 'ns1' fi if [ ! -z "$ns2" ]; then - ns2=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g') + ns2=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g') validate_format 'ns2' fi if [ ! -z "$ns3" ]; then - ns3=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g') + ns3=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g') validate_format 'ns3' fi if [ ! -z "$ns4" ]; then - ns4=$(echo $8 | sed -e 's/\.*$//g' -e 's/^\.*//g') + ns4=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g') validate_format 'ns4' fi @@ -75,7 +70,7 @@ fi # Action # #----------------------------------------------------------# -# Defining variables +# Defining NS variables if [ -z $ns2 ]; then i=1 ns=$(get_user_value '$NS') @@ -88,7 +83,6 @@ soa="$ns1" exp=$(date +%F -d "+ 1 year") ttl=14400 - # Adding zone to dns dir cat $DNSTPL/$template.tpl |\ sed -e "s/%ip%/$ip/g" \ diff --git a/bin/v-add-dns-on-web-alias b/bin/v-add-dns-on-web-alias index 1c0077c7e..a5b0eaf9e 100755 --- a/bin/v-add-dns-on-web-alias +++ b/bin/v-add-dns-on-web-alias @@ -58,7 +58,7 @@ else dom=$(echo "$dom_alias" | sed -e "s/^$sub.//" ) if [ ! -e "$USER_DATA/dns/$dom.conf" ]; then $BIN/v-add-dns-domain \ - $user $dom $IP '' '' '' '' '' $restart > /dev/null + $user $dom $IP '' '' '' '' $restart > /dev/null if [ $? -eq 0 ]; then $BIN/v-add-dns-domain-record \ diff --git a/bin/v-add-domain b/bin/v-add-domain index 2619663ef..24a9194e3 100755 --- a/bin/v-add-domain +++ b/bin/v-add-domain @@ -51,9 +51,11 @@ fi if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then $BIN/v-add-web-domain $user $domain $ip retun_code=$? - if [ "$PROXY_SYSTEM" = 'nginx' ] && [ "$retun_code" -eq 0 ]; then - $BIN/v-add-web-domain-nginx $user $domain - fi +fi + +# Proxy support +if [ ! -z "$PROXY_SYSTEM" ] && [ "$retun_code" -eq 0 ]; then + $BIN/v-add-web-domain-proxy $user $domain fi # DNS domain diff --git a/bin/v-add-sys-ip b/bin/v-add-sys-ip index 74884a48b..112b4776b 100755 --- a/bin/v-add-sys-ip +++ b/bin/v-add-sys-ip @@ -19,7 +19,7 @@ ip=${1// /} mask=$2 interface="${3-eth0}" user="${4-admin}" -ip_status="${5-shared}" # can be dedicated as well +ip_status="${5-shared}" # status can be dedicated ip_name=$6 nat_ip=$7 @@ -50,27 +50,64 @@ fi #----------------------------------------------------------# # Action # #----------------------------------------------------------# - -# Get full interface name get_ip_iface +sys_ip_check=$(/sbin/ifconfig | grep "addr:$ip ") +if [ -z "$sys_ip_check" ]; then + /sbin/ifconfig "$iface" "$ip" netmask "$mask" -# Defining config paths -conf='/etc/httpd/conf.d/vesta.conf' -nconf='/etc/nginx/conf.d/vesta_ip.conf' -iconf='/etc/sysconfig/network-scripts/ifcfg' -rconf='/etc/httpd/conf.d/mod_extract_forwarded.conf' - -# Adding ip -/sbin/ifconfig "$iface" "$ip" netmask "$mask" - -# Adding startup script -create_ip_startup + # Adding startup script + sys_ip="# Added by vesta" + sys_ip="$sys_ip\nDEVICE=$iface" + sys_ip="$sys_ip\nBOOTPROTO=static" + sys_ip="$sys_ip\nONBOOT=yes" + sys_ip="$sys_ip\nIPADDR=$ip" + sys_ip="$sys_ip\nNETMASK=$mask" + echo -e $sys_ip > /etc/sysconfig/network-scripts/ifcfg-$iface +fi # Adding vesta ip -create_vesta_ip +echo "OWNER='$user' +STATUS='$ip_status' +NAME='$ip_name' +U_SYS_USERS='' +U_WEB_DOMAINS='0' +INTERFACE='$interface' +NETMASK='$mask' +NAT='$nat_ip' +TIME='$TIME' +DATE='$DATE'" > $VESTA/data/ips/$ip +chmod 660 $VESTA/data/ips/$ip -# Namehosting support -namehost_ip_support +# WEB support +web_conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" +if [ "$WEB_SYSTEM" = 'httpd' ]; then + conf_ins='1' + conf_line=$(grep -n NameVirtual $web_conf | tail -n1 | cut -f1 -d:) + if [ ! -z "$conf_line" ]; then + conf_ins=$((conf_line + 1)) + fi + if [ "$WEB_SSL" = 'mod_ssl' ]; then + sed -i "$conf_ins i NameVirtualHost $ip:$WEB_SSL_PORT" $web_conf + sed -i "$conf_ins i Listen $ip:$WEB_SSL_PORT" $web_conf + fi + sed -i "$conf_ins i NameVirtualHost $ip:$WEB_PORT" $web_conf + sed -i "$conf_ins i Listen $ip:$WEB_PORT" $web_conf +fi + +# Proxy support +if [ ! -z "$PROXY_SYSTEM" ]; then + cat $WEBTPL/$PROXY_SYSTEM/proxy_ip.tpl |\ + sed -e "s/%ip%/$ip/g" \ + -e "s/%web_port%/$WEB_PORT/g" \ + -e "s/%proxy_port%/$PROXY_PORT/g" \ + > /etc/$PROXY_SYSTEM/conf.d/$ip.conf + + fw_conf="/etc/$WEB_SYSTEM/conf.d/mod_extract_forwarded.conf" + if [ -e "$fw_conf" ]; then + ips=$(grep 'MEFaccept ' $fw_conf | grep -v '#' | head -n1) + sed -i "s/$ips/$ips $ip/g" $fw_conf + fi +fi #----------------------------------------------------------# @@ -93,9 +130,8 @@ else fi # Restart web server -if [ "$web_restart" = 'yes' ]; then - $BIN/v-restart-web "$EVENT" -fi +$BIN/v-restart-web +$BIN/v-restart-proxy # Logging log_history "added system ip address $ip" '' 'admin' diff --git a/bin/v-add-web-domain b/bin/v-add-web-domain index e150d2530..e56f307cb 100755 --- a/bin/v-add-web-domain +++ b/bin/v-add-web-domain @@ -1,6 +1,6 @@ #!/bin/bash # info: add web domain -# options: USER DOMAIN IP [TEMPLATE] [RESTART] +# options: USER DOMAIN IP [RESTART] # # The function adds virtual host to a server. In cases when a template is # undefined in the script, the template "default" will be used. The alias of @@ -21,8 +21,7 @@ domain=$(echo $domain | sed -e 's/\.*$//g' -e 's/^\.*//g') domain=$(echo $domain | tr '[:upper:]' '[:lower:]') domain_idn=$(idn -t --quiet -a "$domain") ip=$3 -template=$4 -restart=$5 +restart=$4 # Includes source $VESTA/conf/vesta.conf @@ -35,7 +34,7 @@ source $VESTA/func/ip.sh # Verifications # #----------------------------------------------------------# -check_args '3' "$#" 'USER DOMAIN IP [TEMPLATE] [RESTART]' +check_args '3' "$#" 'USER DOMAIN IP [RESTART]' validate_format 'user' 'domain' 'ip' is_system_enabled "$WEB_SYSTEM" is_object_valid 'user' 'USER' "$user" @@ -44,13 +43,9 @@ is_domain_new 'web' is_ip_valid is_ip_avalable is_package_full 'WEB_DOMAINS' -if [ ! -z "$template" ]; then - validate_format 'template' - is_apache_template_valid -else - template=$(get_user_value '$TEMPLATE') - is_apache_template_valid -fi + +template=$(get_user_value '$WEB_TEMPLATE') +is_web_template_valid #----------------------------------------------------------# @@ -82,10 +77,10 @@ fi group="$user" email="$user@$domain" docroot="$HOMEDIR/$user/web/$domain/public_html" -conf="$HOMEDIR/$user/conf/web/httpd.conf" -tpl_file="$WEBTPL/apache/$template.tpl" +tpl_file="$WEBTPL/$WEB_SYSTEM/$template.tpl" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" -# Adding domain to the httpd.conf +# Adding web config add_web_config # Building directory tree @@ -99,12 +94,13 @@ mkdir -p $HOMEDIR/$user/web/$domain \ $HOMEDIR/$user/web/$domain/logs # Adding domain logs -touch /var/log/httpd/domains/$domain.bytes \ - /var/log/httpd/domains/$domain.log \ - /var/log/httpd/domains/$domain.error.log +touch /var/log/$WEB_SYSTEM/domains/$domain.bytes \ + /var/log/$WEB_SYSTEM/domains/$domain.log \ + /var/log/$WEB_SYSTEM/domains/$domain.error.log # Adding symlink for logs -ln -f -s /var/log/httpd/domains/$domain.*log $HOMEDIR/$user/web/$domain/logs/ +ln -f -s /var/log/$WEB_SYSTEM/domains/$domain.*log \ + $HOMEDIR/$user/web/$domain/logs/ # Adding domain skeleton if [ -e "$WEBTPL/skel/public_html/" ]; then @@ -127,11 +123,11 @@ done # Changing file owner chown -R $user:$user $HOMEDIR/$user/web/$domain -chown root:$user /var/log/httpd/domains/$domain.* -chown root:apache $conf +chown root:$user /var/log/$WEB_SYSTEM/domains/$domain.* +chown root:$user $conf # Changing file permissions -chmod 660 $conf +chmod 640 $conf chmod 551 $HOMEDIR/$user/web/$domain chmod 751 $HOMEDIR/$user/web/$domain/private chmod 751 $HOMEDIR/$user/web/$domain/cgi-bin @@ -143,18 +139,17 @@ chmod -f -R 665 $HOMEDIR/$user/web/$domain/public_html/* chmod -f -R 665 $HOMEDIR/$user/web/$domain/document_errors/* chmod 551 $HOMEDIR/$user/web/$domain/stats chmod 551 $HOMEDIR/$user/web/$domain/logs -chmod 640 /var/log/httpd/domains/$domain.* +chmod 640 /var/log/$WEB_SYSTEM/domains/$domain.* # Running template trigger -if [ -x $WEBTPL/apache/$template.sh ]; then - $WEBTPL/apache/$template.sh $user $domain $ip $HOMEDIR $docroot +if [ -x $WEBTPL/$WEB_SYSTEM/$template.sh ]; then + $WEBTPL/$WEB_SYSTEM/$template.sh $user $domain $ip $HOMEDIR $docroot fi -# Checking main vesta httpd config -main_conf='/etc/httpd/conf.d/vesta.conf' -main_conf_check=$(grep "$conf" $main_conf ) -if [ -z "$main_conf_check" ]; then - echo "Include $conf" >>$main_conf +# Checking web config +web_conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" +if [ -z "$(grep $conf $web_conf)" ]; then + echo "Include $conf" >> $web_conf fi @@ -170,7 +165,7 @@ increase_user_value "$user" '$U_WEB_ALIASES' # Defining domain variables str="DOMAIN='$domain' IP='$IP' IP6='' ALIAS='$aliases' TPL='$template'" str="$str SSL='no' SSL_HOME='same' FTP_USER='' FTP_MD5=''" -str="$str NGINX='' NGINX_EXT='' STATS='' STATS_USER=''" +str="$str PROXY='' PROXY_EXT='' STATS='' STATS_USER=''" str="$str STATS_CRYPT='' U_DISK='0' U_BANDWIDTH='0' SUSPENDED='no'" str="$str TIME='$TIME' DATE='$DATE'" @@ -180,7 +175,7 @@ chmod 660 $USER_DATA/web.conf # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web fi # Logging diff --git a/bin/v-add-web-domain-alias b/bin/v-add-web-domain-alias index c3e99cb69..10cc15b7c 100755 --- a/bin/v-add-web-domain-alias +++ b/bin/v-add-web-domain-alias @@ -49,8 +49,8 @@ is_package_full 'WEB_ALIASES' # Parsing domain values get_domain_values 'web' -tpl_file="$WEBTPL/apache/$TPL.tpl" -conf="$HOMEDIR/$user/conf/web/httpd.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" ip=$(get_real_ip $IP) # Parsing domain aliases @@ -68,22 +68,22 @@ del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" del_web_config add_web_config fi -# Checking nginx -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/nginx.conf" +# Checking proxy +if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" del_web_config add_web_config fi @@ -102,7 +102,8 @@ increase_user_value "$user" '$U_WEB_ALIASES' # Adding task to the vesta pipe if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi log_history "added $dom_alias as alias for $domain" diff --git a/bin/v-add-web-domain-ftp b/bin/v-add-web-domain-ftp index 4a343cb22..6e55947c0 100755 --- a/bin/v-add-web-domain-ftp +++ b/bin/v-add-web-domain-ftp @@ -55,9 +55,19 @@ if [ ! -z "$FTP_USER" ]; then /usr/sbin/userdel -f $FTP_USER fi +# Define shell +shell='/sbin/nologin' +if [ -e "/usr/bin/rssh" ]; then + shell='/usr/bin/rssh' +fi + # Adding user -/usr/sbin/adduser -o -u $(id -u $user) -g $user -s /sbin/nologin -M \ - -d "$HOMEDIR/$user/web/$domain" $ftp_user > /dev/null 2>&1 +/usr/sbin/adduser -o -u $(id -u $user) \ + -g $user \ + -s $shell \ + -M -d "$HOMEDIR/$user/web/$domain" \ + $ftp_user > /dev/null 2>&1 + echo "$ftp_password" | /usr/bin/passwd "$ftp_user" --stdin &>/dev/null ftp_md5="$(awk -v user=$ftp_user -F : 'user == $1 {print $2}' /etc/shadow)" diff --git a/bin/v-add-web-domain-nginx b/bin/v-add-web-domain-proxy similarity index 62% rename from bin/v-add-web-domain-nginx rename to bin/v-add-web-domain-proxy index 45915bf67..eb94f4c6d 100755 --- a/bin/v-add-web-domain-nginx +++ b/bin/v-add-web-domain-proxy @@ -1,9 +1,9 @@ #!/bin/bash -# info: add webdomain nginx support +# info: add webdomain proxy support # options: USER DOMAIN [TEMPLATE] [EXTENTIONS] [RESTART] # -# The function enables nginx support for a domain. It can significantly improve -# website speed. +# The function enables proxy support for a domain. This can significantly +# improve website speed. #----------------------------------------------------------# @@ -38,14 +38,11 @@ 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_object_value_empty 'web' 'DOMAIN' "$domain" '$NGINX' -if [ ! -z "$template" ]; then - validate_format 'template' - is_nginx_template_valid -else - template=$(get_user_value '$TEMPLATE') - is_nginx_template_valid +is_object_value_empty 'web' 'DOMAIN' "$domain" '$PROXY' +if [ -z $template ]; then + template=$(get_user_value '$PROXY_TEMPLATE') fi +is_proxy_template_valid #----------------------------------------------------------# @@ -54,10 +51,10 @@ fi # Defining domain parameters get_domain_values 'web' -NGINX="$template" -NGINX_EXT="$extentions" -tpl_file="$WEBTPL/nginx/$NGINX.tpl" -conf="$HOMEDIR/$user/conf/web/nginx.conf" +PROXY="$template" +PROXY_EXT="$extentions" +tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" +conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" ip=$(get_real_ip $IP) # Preparing domain values for the template substitution @@ -65,49 +62,45 @@ upd_web_domain_values add_web_config # Set permission and ownership -chown root:nginx $conf +chown root:$user $conf chmod 640 $conf -# Checking main vesta httpd config -main_conf='/etc/nginx/conf.d/vesta_users.conf' -main_conf_check=$(grep "$conf" $main_conf ) -if [ -z "$main_conf_check" ]; then - echo "include $conf;" >>$main_conf +# Checking proxy config +proxy_conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" +if [ -z "$(grep "$conf" $proxy_conf)" ]; then + echo "include $conf;" >> $proxy_conf fi # Checking ssl if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" add_web_config - chown root:nginx $conf + chown root:$user $conf chmod 640 $conf - main_conf='/etc/nginx/conf.d/vesta_users.conf' - main_conf_check=$(grep "$conf" $main_conf ) - if [ -z "$main_conf_check" ]; then - echo "include $conf;" >>$main_conf + proxy_conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" + if [ -z "$(grep "$conf" $proxy_conf)" ]; then + echo "include $conf;" >> $proxy_conf fi fi - #----------------------------------------------------------# # Vesta # #----------------------------------------------------------# # Update config -update_object_value 'web' 'DOMAIN' "$domain" '$NGINX' "$NGINX" -update_object_value 'web' 'DOMAIN' "$domain" '$NGINX_EXT' "$extentions" +update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$PROXY" +update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions" # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-proxy "$EVENT" fi -log_history "enabled nginx support for $domain" +log_history "enabled proxy support for $domain" log_event "$OK" "$EVENT" exit - diff --git a/bin/v-add-web-domain-ssl b/bin/v-add-web-domain-ssl index d3a38e37c..b8f2a292f 100755 --- a/bin/v-add-web-domain-ssl +++ b/bin/v-add-web-domain-ssl @@ -41,7 +41,6 @@ is_object_unsuspended 'user' 'USER' "$user" is_object_valid 'web' 'DOMAIN' "$domain" is_object_unsuspended 'web' 'DOMAIN' "$domain" is_object_value_empty 'web' 'DOMAIN' "$domain" '$SSL' -#is_ip_owner is_web_domain_cert_valid @@ -62,18 +61,18 @@ chmod 660 $USER_DATA/ssl/$domain.* # Parsing domain values get_domain_values 'web' -conf="$HOMEDIR/$user/conf/web/shttpd.conf" -tpl_file="$WEBTPL/apache/$TPL.stpl" +conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" SSL_HOME="$ssl_home" ip=$(get_real_ip $IP) # Preparing domain values for the template substitution upd_web_domain_values -# Adding domain to the shttpd.conf +# Adding domain to the web config add_web_config -chown root:apache $conf +chown root:$user $conf chmod 640 $conf # Adding certificate to user dir @@ -85,32 +84,29 @@ if [ -e "$USER_DATA/ssl/$domain.ca" ]; then fi # Running template trigger -if [ -x $WEBTPL/apache/$template.sh ]; then - $WEBTPL/apache/$template.sh $user $domain $ip $HOMEDIR $sdocroot +if [ -x $WEBTPL/$WEB_SYSTEM/$template.sh ]; then + $WEBTPL/$WEB_SYSTEM/$template.sh $user $domain $ip $HOMEDIR $sdocroot fi -# Checking main vesta httpd config -main_conf='/etc/httpd/conf.d/vesta.conf' -main_conf_check=$(grep "$conf" $main_conf ) -if [ -z "$main_conf_check" ]; then - echo "Include $conf" >> $main_conf +# Checking web config +web_conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" +if [ -z "$(grep "$conf" $web_conf)" ]; then + echo "Include $conf" >> $web_conf fi -# Checking nginx -if [ ! -z "$NGINX" ]; then - # Adding domain to the snginx.conf - conf="$HOMEDIR/$user/conf/web/snginx.conf" - tpl_file="$WEBTPL/nginx/$NGINX.stpl" +# Checking proxy +if [ ! -z "$PROXY" ]; then + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" add_web_config - chown root:nginx $conf + chown root:$user $conf chmod 640 $conf - # Checking vesta nginx config - main_conf='/etc/nginx/conf.d/vesta_users.conf' - main_conf_check=$(grep "$conf" $main_conf ) - if [ -z "$main_conf_check" ]; then - echo "include $conf;" >>$main_conf + # Checking proxy config + proxy_conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" + if [ -z "$(grep "$conf" $proxy_conf )" ]; then + echo "include $conf;" >> $proxy_conf fi fi diff --git a/bin/v-backup-user b/bin/v-backup-user index 2552fb76b..de011a952 100755 --- a/bin/v-backup-user +++ b/bin/v-backup-user @@ -166,36 +166,33 @@ then conf="$USER_DATA/web.conf" grep "DOMAIN='$domain'" $conf > vesta/web.conf - # Apache config - if [ "$WEB_SYSTEM" = 'apache' ]; then - # Parsing httpd.conf - tpl_file="$WEBTPL/apache/$TPL.tpl" - conf="$HOMEDIR/$user/conf/web/httpd.conf" - get_web_config_brds - sed -n "$top_line,$bottom_line p" $conf > conf/httpd.conf + # WEB config + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" + conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" + get_web_config_brds + sed -n "$top_line,$bottom_line p" $conf > conf/$WEB_SYSTEM.conf - # SSL check - if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" - get_web_config_brds - sed -n "$top_line,$bottom_line p" $conf > conf/shttpd.conf - fi + # SSL check + if [ "$SSL" = 'yes' ]; then + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" + get_web_config_brds + sed -n "$top_line,$bottom_line p" $conf > conf/s$WEB_SYSTEM.conf fi - # Nginx config - if [ ! -z "$NGINX" ] ; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/nginx.conf" + # Proxy config + if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" get_web_config_brds - sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf + sed -n "$top_line,$bottom_line p" $conf > conf/$PROXY_SYSTEM.conf - # SSL check - if [ "$SSL" = 'yes' ] ; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" - get_web_config_brds - sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf + # SSL proxy config + if [ ! -z "$PROXY" ] && [ "$SSL" = 'yes' ] ; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" + get_web_config_brds + sed -n "$top_line,$bottom_line p" $conf > conf/s$PROXY_SYSTEM.conf fi fi diff --git a/bin/v-change-user-package b/bin/v-change-user-package index 34ccdd8bf..ed30b2ed2 100755 --- a/bin/v-change-user-package +++ b/bin/v-change-user-package @@ -62,7 +62,9 @@ change_user_package() { echo "FNAME='$FNAME' LNAME='$LNAME' PACKAGE='$package' -TEMPLATE='$TEMPLATE' +WEB_TEMPLATE='$WEB_TEMPLATE' +PROXY_TEMPLATE='$PROXY_TEMPLATE' +DNS_TEMPLATE='$DNS_TEMPLATE' WEB_DOMAINS='$WEB_DOMAINS' WEB_ALIASES='$WEB_ALIASES' DNS_DOMAINS='$DNS_DOMAINS' diff --git a/bin/v-change-user-template b/bin/v-change-user-template index 54382f12f..cddfcbdcb 100755 --- a/bin/v-change-user-template +++ b/bin/v-change-user-template @@ -1,6 +1,6 @@ #!/bin/bash # info: change user default template -# options: USER TEMPLATE +# options: USER TYPE TEMPLATE # # The function changes default user web template. @@ -11,7 +11,8 @@ # Argument defenition user=$1 -template=$2 +type=$(echo "$2" | tr '[:lower:]' '[:upper:]') +template=$3 # Includes source $VESTA/conf/vesta.conf @@ -23,27 +24,33 @@ source $VESTA/func/domain.sh # Verifications # #----------------------------------------------------------# -check_args '2' "$#" 'USER TEMPLATE' +check_args '3' "$#" 'USER TYPE TEMPLATE' validate_format 'user' 'template' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" -is_apache_template_valid #----------------------------------------------------------# # Action # #----------------------------------------------------------# +case $type in + WEB) is_web_template_valid; + update_user_value "$user" '$WEB_TEMPLATE' "$template";; + PROXY) is_proxy_template_valid; + update_user_value "$user" '$PROXY_TEMPLATE' "$template";; + DNS) is_dns_template_valid; + update_user_value "$user" '$DNS_TEMPLATE' "$template";; + *) check_args '1' '0' 'USER TYPE TEMPLATE' +esac + #----------------------------------------------------------# # Vesta # #----------------------------------------------------------# -# Changing user shell -update_user_value "$user" '$TEMPLATE' "$template" - # Logging -log_history "changed $user template to $template" '' 'admin' +log_history "changed $type template to $template" log_event "$OK" "$EVENT" exit diff --git a/bin/v-change-web-domain-ip b/bin/v-change-web-domain-ip index c4acc5728..9e1f0fe88 100755 --- a/bin/v-change-web-domain-ip +++ b/bin/v-change-web-domain-ip @@ -2,8 +2,7 @@ # info: change web domain ip address # options: USER DOMAIN IP [RESTART] # -# The call is used for changing the site ip address. The ip change will be -# performed for a virtual apache host and for a configuration nginx file both. +# The call is used for changing the site ip address. #----------------------------------------------------------# @@ -46,30 +45,30 @@ is_ip_avalable # Define variable for replace get_domain_values 'web' ip=$(get_real_ip $ip) -tpl_file="$WEBTPL/apache/$TPL.tpl" -conf="$HOMEDIR/$user/conf/web/httpd.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" old=$(get_real_ip $IP) new=$ip replace_web_config -# Checking ssl +# Checking SSL if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" replace_web_config fi -# Checking nginx -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/nginx.conf" +# Checking proxy +if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" replace_web_config fi -# Checking nginx -if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" +# Checking SSL proxy +if [ "$SSL" = 'yes' ] && [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" replace_web_config fi @@ -87,7 +86,8 @@ update_object_value 'web' 'DOMAIN' "$domain" '$IP' "$3" # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-change-web-domain-nginx-tpl b/bin/v-change-web-domain-proxy-tpl similarity index 67% rename from bin/v-change-web-domain-nginx-tpl rename to bin/v-change-web-domain-proxy-tpl index 0e278fe41..14642aaff 100755 --- a/bin/v-change-web-domain-nginx-tpl +++ b/bin/v-change-web-domain-proxy-tpl @@ -1,9 +1,8 @@ #!/bin/bash -# info: change web domain nginx template +# info: change web domain proxy template # options: USER DOMAIN TEMPLATE [EXTENTIONS] [RESTART] # -# The function changes template of nginx.conf configuration file. The content -# of webdomain directories remains untouched. +# The function changes proxy template #----------------------------------------------------------# @@ -39,8 +38,8 @@ 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_object_value_exist 'web' 'DOMAIN' "$domain" '$NGINX' -is_nginx_template_valid +is_object_value_exist 'web' 'DOMAIN' "$domain" '$PROXY' +is_proxy_template_valid #----------------------------------------------------------# @@ -49,36 +48,29 @@ is_nginx_template_valid # Parsing domain values get_domain_values 'web' -tpl_file="$WEBTPL/nginx/$NGINX.tpl" -conf="$HOMEDIR/$user/conf/web/nginx.conf" +tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" +conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" ip=$(get_real_ip $IP) # Delete old vhost del_web_config -# Checking ssl -if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" - del_web_config -fi - # Add new vhost -NGINX="$template" -NGINX_EXT="$extentions" -tpl_file="$WEBTPL/nginx/$NGINX.tpl" -conf="$HOMEDIR/$user/conf/web/nginx.conf" +PROXY="$template" +PROXY_EXT="$extentions" upd_web_domain_values add_web_config -chown root:nginx $conf +chown root:$user $conf chmod 640 $conf -# Checking ssl +# Checking SSL if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" + del_web_config + add_web_config - chown root:nginx $conf + chown root:$user $conf chmod 640 $conf fi @@ -88,16 +80,16 @@ fi #----------------------------------------------------------# # Update config -update_object_value 'web' 'DOMAIN' "$domain" '$NGINX' "$NGINX" -update_object_value 'web' 'DOMAIN' "$domain" '$NGINX_EXT' "$extentions" +update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$PROXY" +update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions" # Restart web if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-proxy fi # Logging -log_history "changed nginx template for $domain to $template" +log_history "changed proxy template for $domain to $template" log_event "$OK" "$EVENT" exit diff --git a/bin/v-change-web-domain-sslcert b/bin/v-change-web-domain-sslcert index 28b318817..cbfa4c271 100755 --- a/bin/v-change-web-domain-sslcert +++ b/bin/v-change-web-domain-sslcert @@ -70,7 +70,8 @@ fi #----------------------------------------------------------# # Restart web server -$BIN/v-restart-web "$EVENT" +$BIN/v-restart-web +$BIN/v-restart-proxy # Logging log_history "changed ssl certificate for $domain" diff --git a/bin/v-change-web-domain-sslhome b/bin/v-change-web-domain-sslhome index d43a139c2..533b1073e 100755 --- a/bin/v-change-web-domain-sslhome +++ b/bin/v-change-web-domain-sslhome @@ -39,8 +39,8 @@ is_object_value_exist 'web' 'DOMAIN' "$domain" '$SSL' get_domain_values 'web' old_ssl_home=$SSL_HOME SSL_HOME=$ssl_home -tpl_file="$WEBTPL/apache/$TPL.stpl" -conf="$HOMEDIR/$user/conf/web/shttpd.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" +conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" # Parsing tpl_option case $SSL_HOME in @@ -54,10 +54,10 @@ esac # Changing sslhome directory replace_web_config -# Checking nginx config -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" +# Checking proxy config +if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" replace_web_config fi @@ -70,7 +70,8 @@ fi update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME" # Restart web server -$BIN/v-restart-web "$EVENT" +$BIN/v-restart-web +$BIN/v-restart-proxy # Logging log_history "changed ssl home for $domain to $ssl_home" diff --git a/bin/v-change-web-domain-tpl b/bin/v-change-web-domain-tpl index 6bb835fb3..581ad60d8 100755 --- a/bin/v-change-web-domain-tpl +++ b/bin/v-change-web-domain-tpl @@ -2,7 +2,7 @@ # info: change web domain template # options: USER DOMAIN TEMPLATE [RESTART] # -# The function changes template of httpd.conf configuration file. The content +# The function changes template of the web configuration file. The content # of webdomain directories remains untouched. @@ -35,7 +35,7 @@ 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_apache_template_valid +is_web_template_valid #----------------------------------------------------------# @@ -47,40 +47,40 @@ get_domain_values 'web' ip=$(get_real_ip $IP) # Deleting domain -tpl_file="$WEBTPL/apache/$TPL.tpl" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" old_tpl=$TPL -conf="$HOMEDIR/$user/conf/web/httpd.conf" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" del_web_config # Deleting ssl vhost if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" del_web_config fi # Defining variables for new vhost config upd_web_domain_values -tpl_file="$WEBTPL/apache/$template.tpl" +tpl_file="$WEBTPL/$WEB_SYSTEM/$template.tpl" -# Adding domain to the httpd.conf +# Adding domain to the web conf add_web_config # Running template trigger -if [ -x $WEBTPL/apache/$template.sh ]; then - $WEBTPL/apache/$template.sh $user $domain $ip $HOMEDIR $docroot +if [ -x $WEBTPL/$WEB_SYSTEM/$template.sh ]; then + $WEBTPL/$WEB_SYSTEM/$template.sh $user $domain $ip $HOMEDIR $docroot fi -# Checking ssl +# Checking SSL if [ "$SSL" = 'yes' ]; then - conf="$HOMEDIR/$user/conf/web/shttpd.conf" - tpl_file="$WEBTPL/apache/$template.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$template.stpl" add_web_config # Running template trigger - if [ -x $WEBTPL/apache/$template.sh ]; then - $WEBTPL/apache/$template.sh \ + if [ -x $WEBTPL/$WEB_SYSTEM/$template.sh ]; then + $WEBTPL/$WEB_SYSTEM/$template.sh \ "$user" "$domain" "$ip" "$HOMEDIR" "$sdocroot" fi fi @@ -95,7 +95,7 @@ update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template" # Restart web if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web fi # Logging diff --git a/bin/v-delete-sys-ip b/bin/v-delete-sys-ip index c7067b503..eed592ae5 100755 --- a/bin/v-delete-sys-ip +++ b/bin/v-delete-sys-ip @@ -35,34 +35,43 @@ is_ip_key_empty '$U_SYS_USERS' # Action # #----------------------------------------------------------# -# Defining config paths -conf='/etc/httpd/conf.d/vesta.conf' -nconf='/etc/nginx/conf.d/vesta_ip.conf' -iconf='/etc/sysconfig/network-scripts/ifcfg' -rconf='/etc/httpd/conf.d/mod_extract_forwarded.conf' - # Get ip owner user="$(get_ip_value '$OWNER')" ip_status="$(get_ip_value '$STATUS')" # Deleting interface -interface=$(/sbin/ifconfig |grep -B1 "addr:$ip "|head -n 1 |cut -f 1 -d ' ') -if [ ! -z "$interface" ] && [ -z "$(echo $interface|cut -s -f2 -d :)" ]; then - echo "Error: Main IP on interface" +interface=$(/sbin/ifconfig | grep -B1 "dr:$ip " | head -n1 | cut -f1 -d \ ) +if [ ! -z "$interface" ] && [ -z "$(echo $interface |cut -s -f2 -d :)" ]; then + echo "Error: can't delete main IP address" log_event "$E_FORBIDEN" "$EVENT" exit $E_FORBIDEN fi if [ ! -z "$interface" ]; then - /sbin/ifconfig "$interface" down - iconf='/etc/sysconfig/network-scripts/ifcfg' - rm -f $iconf-$interface + /sbin/ifconfig $interface down + rm -f /etc/sysconfig/network-scripts/ifcfg-$interface fi # Deleting vesta ip rm -f $VESTA/data/ips/$ip -# Deleting namehosting support -namehost_ip_disable +# Disable virtual ip hosting support +web_conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" +if [ ! -z "$WEB_SYSTEM" ]; then + sed -i "/NameVirtualHost $ip:/d" $web_conf + sed -i "/Listen $ip:/d" $web_conf +fi + +# Deleting proxy config +if [ ! -z "$PROXY_SYSTEM" ]; then + rm -f /etc/$PROXY_SYSTEM/conf.d/$ip.conf + + fw_conf="/etc/$WEB_SYSTEM/conf.d/mod_extract_forwarded.conf" + if [ -e "$fw_conf" ]; then + ips=$(grep 'MEFaccept 127.0.0.1' $fw_conf) + new_ips=$(echo "$ips" | sed -e "s/$ip//" ) + sed -i "s/$ips/$new_ips/g" $fw_conf + fi +fi #----------------------------------------------------------# @@ -89,12 +98,11 @@ fi # Adding task to the vesta pipe -if [ "$web_restart" = 'yes' ]; then - $BIN/v-restart-web "$EVENT" -fi +$BIN/v-restart-web +$BIN/v-restart-proxy # Logging -log_history "delted system ip address $ip" '' 'admin' +log_history "deleted system ip address $ip" log_event "$OK" "$EVENT" exit diff --git a/bin/v-delete-web-domain b/bin/v-delete-web-domain index 88caabe6e..93b92a1b0 100755 --- a/bin/v-delete-web-domain +++ b/bin/v-delete-web-domain @@ -44,8 +44,8 @@ is_object_unsuspended 'web' 'DOMAIN' "$domain" # Get template name get_domain_values 'web' -tpl_file="$WEBTPL/apache/$TPL.tpl" -conf="$HOMEDIR/$user/conf/web/httpd.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" ip=$(get_real_ip $IP) # Deleting domain @@ -58,26 +58,26 @@ else aliases=0 fi -# Checking ssl +# Checking SSL if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" del_web_config - # Deleting certificates + # Deleting SSL certificates rm -f $HOMEDIR/$user/conf/web/ssl.$domain.* rm -f $USER_DATA/ssl/$domain.* fi -# Checking nginx -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/nginx.conf" +# Checking proxy +if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" del_web_config if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" del_web_config fi fi @@ -98,9 +98,9 @@ fi rm -rf $HOMEDIR/$user/web/$domain # Deleting logs -rm -f /var/log/httpd/domains/$domain.log* -rm -f /var/log/httpd/domains/$domain.bytes -rm -f /var/log/httpd/domains/$domain.error* +rm -f /var/log/$WEB_SYSTEM/domains/$domain.log* +rm -f /var/log/$WEB_SYSTEM/domains/$domain.bytes +rm -f /var/log/$WEB_SYSTEM/domains/$domain.error* #----------------------------------------------------------# @@ -110,34 +110,34 @@ rm -f /var/log/httpd/domains/$domain.error* # Deleting domain sed -i "/DOMAIN='$domain'/ d" $USER_DATA/web.conf -# Checking last ssl domain -conf='/etc/httpd/conf.d/vesta.conf' +# Checking last SSL domain +conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf | wc -l) if [ "$ssl_dom" -eq '0' ]; then - sed -i "/.*\/$user\/.*shttpd.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/shttpd.conf + sed -i "/.*\/$user\/.*s$WEB_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf fi # Checking last domain -domains=$(wc -l $USER_DATA/web.conf|cut -f 1 -d ' ') +domains=$(wc -l $USER_DATA/web.conf | cut -f1 -d ' ') if [ "$domains" -eq '0' ]; then - sed -i "/.*\/$user\/.*httpd.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/httpd.conf + sed -i "/.*\/$user\/.*$WEB_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf fi -# Checking last ssl nginx domain -conf='/etc/nginx/conf.d/vesta_users.conf' -last_snginx=$(echo "$last_nginx" | grep "SSL='yes'") -if [ -z "$last_snginx" ]; then - sed -i "/.*\/$user\/.*snginx.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/snginx.conf +# Checking last SSL proxy +conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" +last_sproxy=$(grep "SSL='yes'" $USER_DATA/web.conf) +if [ -z "$last_sproxy" ]; then + sed -i "/.*\/$user\/.*s$PROXY_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf fi -# Checking last nginx domain -last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf) -if [ -z "$last_nginx" ]; then - sed -i "/.*\/$user\/.*nginx.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/nginx.conf +# Checking last proxy +last_proxy=$(grep -v "PROXY=''" $USER_DATA/web.conf) +if [ -z "$last_proxy" ]; then + sed -i "/.*\/$user\/.*$PROXY_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf fi # Decrease counters @@ -150,7 +150,8 @@ fi # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-delete-web-domain-alias b/bin/v-delete-web-domain-alias index 7e0746dc7..c67c5aecd 100755 --- a/bin/v-delete-web-domain-alias +++ b/bin/v-delete-web-domain-alias @@ -55,8 +55,8 @@ ALIAS=$(echo "$ALIAS" |\ sed -e "s/^$dom_alias$//g"|\ sed -e "/^$/d"|\ sed -e ':a;N;$!ba;s/\n/,/g') -tpl_file="$WEBTPL/apache/$TPL.tpl" -conf="$HOMEDIR/$user/conf/web/httpd.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" # Preparing domain values for the template substitution upd_web_domain_values @@ -66,22 +66,22 @@ del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" del_web_config add_web_config fi -# Checking nginx -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/nginx.conf" +# Checking proxy +if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" del_web_config add_web_config if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" del_web_config add_web_config fi @@ -100,7 +100,8 @@ decrease_user_value "$user" '$U_WEB_ALIASES' # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-delete-web-domain-nginx b/bin/v-delete-web-domain-proxy similarity index 58% rename from bin/v-delete-web-domain-nginx rename to bin/v-delete-web-domain-proxy index 701c5b318..fb54c9c1c 100755 --- a/bin/v-delete-web-domain-nginx +++ b/bin/v-delete-web-domain-proxy @@ -1,8 +1,8 @@ #!/bin/bash -# info: deleting web domain nginx configuration +# info: deleting web domain proxy configuration # options: USER DOMAIN # -# The function of deleting the virtualhost nginx configuration. +# The function of deleting the virtualhost proxy configuration. #----------------------------------------------------------# @@ -32,7 +32,7 @@ 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_object_value_exist 'web' 'DOMAIN' "$domain" '$NGINX' +is_object_value_exist 'web' 'DOMAIN' "$domain" '$PROXY' #----------------------------------------------------------# @@ -41,14 +41,14 @@ is_object_value_exist 'web' 'DOMAIN' "$domain" '$NGINX' # Defining domain parameters get_domain_values 'web' -tpl_file="$WEBTPL/nginx/$NGINX.tpl" -conf="$HOMEDIR/$user/conf/web/nginx.conf" +tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" +conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" del_web_config -# Checking ssl +# Checking SSL if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" del_web_config fi @@ -58,30 +58,32 @@ fi #----------------------------------------------------------# # Update config -update_object_value 'web' 'DOMAIN' "$domain" '$NGINX' '' -update_object_value 'web' 'DOMAIN' "$domain" '$NGINX_EXT' '' +update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' '' +update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' '' -# Checking last nginx domain -conf='/etc/nginx/conf.d/vesta_users.conf' -last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf) -last_snginx=$(echo "$last_nginx" | grep "SSL='yes'") -if [ -z "$last_snginx" ]; then - sed -i "/$user\/conf\/web\/snginx.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/snginx.conf + +# Checking last SSL proxy +conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" +last_sproxy=$(grep "SSL='yes'" $USER_DATA/web.conf) +if [ -z "$last_sproxy" ]; then + sed -i "/.*\/$user\/.*s$PROXY_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf fi -if [ -z "$last_nginx" ]; then - sed -i "/$user\/conf\/web\/nginx.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/nginx.conf +# Checking last proxy +last_proxy=$(grep -v "PROXY=''" $USER_DATA/web.conf) +if [ -z "$last_proxy" ]; then + sed -i "/.*\/$user\/.*$PROXY_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf fi -# Restart web server +# Restart proxy server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-proxy fi # Logging -log_history "disabled nginx support for $domain" +log_history "disabled proxy support for $domain" log_event "$OK" "$EVENT" exit diff --git a/bin/v-delete-web-domain-ssl b/bin/v-delete-web-domain-ssl index f4d315508..16bd6ca57 100755 --- a/bin/v-delete-web-domain-ssl +++ b/bin/v-delete-web-domain-ssl @@ -1,5 +1,5 @@ #!/bin/bash -# info: delete web domain ssl support +# info: delete web domain SSL support # options: USER DOMAIN # # The function disable https support and deletes SSL certificates. @@ -41,16 +41,16 @@ is_object_value_exist 'web' 'DOMAIN' "$domain" '$SSL' # Parsing domain values get_domain_values 'web' -conf="$HOMEDIR/$user/conf/web/shttpd.conf" -tpl_file="$WEBTPL/apache/$TPL.stpl" +conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" # Deleting domain del_web_config -# Checking nginx -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" +# Checking proxy +if [ ! -z "$PROXY" ]; then + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" del_web_config fi @@ -68,21 +68,22 @@ chown -R $user:$user $tmpdir # Update config update_object_value 'web' 'DOMAIN' "$domain" '$SSL' 'no' -# Checking last ssl domain +# Checking last SSL domain ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf) -conf='/etc/httpd/conf.d/vesta.conf' +conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" if [ -z "$ssl_dom" ]; then - sed -i "/.*\/$user\/.*shttpd.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/shttpd.conf + sed -i "/.*\/$user\/.*s$WEB_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf + fi -# Checking last nginx domain -conf='/etc/nginx/conf.d/vesta_users.conf' -last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf) -last_snginx=$(echo "$last_nginx" | grep "SSL='yes'") -if [ -z "$last_snginx" ]; then - sed -i "/.*\/$user\/.*snginx.conf/d" $conf - rm -f $HOMEDIR/$user/conf/web/snginx.conf +# Checking proxy +if [ ! -z "$PROXY_SYSTEM" ]; then + conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" + if [ -z "$ssl_dom" ]; then + sed -i "/.*\/$user\/.*s$PROXY_SYSTEM.conf/d" $conf + rm -f $HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf + fi fi # Decreasing domain value @@ -90,7 +91,8 @@ decrease_user_value "$user" '$U_WEB_SSL' # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-delete-web-domains b/bin/v-delete-web-domains index 2824433fa..b12822556 100755 --- a/bin/v-delete-web-domains +++ b/bin/v-delete-web-domains @@ -44,7 +44,8 @@ done # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-list-user b/bin/v-list-user index b8decbc65..ea818ac1f 100755 --- a/bin/v-list-user +++ b/bin/v-list-user @@ -72,15 +72,16 @@ is_object_valid 'user' 'USER' "$user" conf=$USER_DATA/user.conf # Defining fileds to select -fields='$USER $FNAME $LNAME $PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_ALIASES - $DNS_DOMAINS $DNS_RECORDS $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES - $CRON_JOBS $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $CONTACT - $CRON_REPORTS $RKEY $SUSPENDED $SUSPENDED_USERS $SUSPENDED_WEB - $SUSPENDED_DNS $SUSPENDED_MAIL $SUSPENDED_DB $SUSPENDED_CRON $IP_AVAIL - $IP_OWNED $U_USERS $U_DISK $U_DISK_DIRS $U_DISK_WEB $U_DISK_MAIL $U_DISK_DB - $U_BANDWIDTH $U_WEB_DOMAINS $U_WEB_SSL $U_WEB_ALIASES $U_DNS_DOMAINS - $U_DNS_RECORDS $U_MAIL_DOMAINS $U_MAIL_DKIM $U_MAIL_ACCOUNTS $U_DATABASES - $U_CRON_JOBS $U_BACKUPS $LANGUAGE $TIME $DATE' +fields='$USER $FNAME $LNAME $PACKAGE $WEB_TEMPLATE $PROXY_TEMPLATE + $DNS_TEMPLATE $WEB_DOMAINS $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS + $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH + $NS $SHELL $BACKUPS $CONTACT $CRON_REPORTS $RKEY $SUSPENDED + $SUSPENDED_USERS $SUSPENDED_WEB $SUSPENDED_DNS $SUSPENDED_MAIL + $SUSPENDED_DB $SUSPENDED_CRON $IP_AVAIL $IP_OWNED $U_USERS $U_DISK + $U_DISK_DIRS $U_DISK_WEB $U_DISK_MAIL $U_DISK_DB $U_BANDWIDTH + $U_WEB_DOMAINS $U_WEB_SSL $U_WEB_ALIASES $U_DNS_DOMAINS $U_DNS_RECORDS + $U_MAIL_DOMAINS $U_MAIL_DKIM $U_MAIL_ACCOUNTS $U_DATABASES $U_CRON_JOBS + $U_BACKUPS $LANGUAGE $TIME $DATE' # Listing user case $format in diff --git a/bin/v-list-user-package b/bin/v-list-user-package index 13941589c..df26482a0 100755 --- a/bin/v-list-user-package +++ b/bin/v-list-user-package @@ -72,9 +72,10 @@ is_package_valid #----------------------------------------------------------# # Defining fileds to select -fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS - $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH - $NS $SHELL $BACKUPS $TIME $DATE' +fields='$PACKAGE $WEB_TEMPLATE $PROXY_TEMPLATE $DNS_TEMPLATE $WEB_DOMAINS + $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS $MAIL_DOMAINS $MAIL_ACCOUNTS + $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $TIME + $DATE' # Listing ip case $format in diff --git a/bin/v-list-user-packages b/bin/v-list-user-packages index a7bb49320..17f7a1c34 100755 --- a/bin/v-list-user-packages +++ b/bin/v-list-user-packages @@ -71,9 +71,10 @@ shell_list_pkgs() { #----------------------------------------------------------# # Defining fields -fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS - $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH - $NS $SHELL $BACKUPS $TIME $DATE' +fields='$PACKAGE $WEB_TEMPLATE $PROXY_TEMPLATE $DNS_TEMPLATE $WEB_DOMAINS + $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS $MAIL_DOMAINS $MAIL_ACCOUNTS + $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $TIME + $DATE' # Listing domains case $format in diff --git a/bin/v-list-users b/bin/v-list-users index 7944f9fe1..a6a6e6451 100755 --- a/bin/v-list-users +++ b/bin/v-list-users @@ -73,11 +73,11 @@ shell_list_users() { #----------------------------------------------------------# # Defining fileds to select -fields="\$USER \$FNAME \$LNAME \$PACKAGE \$TEMPLATE \$WEB_DOMAINS" -fields="$fields \$WEB_ALIASES \$DNS_DOMAINS \$DNS_RECORDS \$MAIL_DOMAINS" -fields="$fields \$MAIL_ACCOUNTS \$DATABASES \$CRON_JOBS \$DISK_QUOTA" -fields="$fields \$BANDWIDTH \$NS \$SHELL \$BACKUPS \$CONTACT" -fields="$fields \$CRON_REPORTS \$RKEY \$SUSPENDED \$SUSPENDED_USERS" +fields="\$USER \$FNAME \$LNAME \$PACKAGE \$WEB_TEMPLATE \$PROXY_TEMPLATE" +fields="$fields \$DNS_TEMPLATE \$WEB_DOMAINS \$WEB_ALIASES \$DNS_DOMAINS" +fields="$fields \$DNS_RECORDS \$MAIL_DOMAINS \$MAIL_ACCOUNTS \$DATABASES" +fields="$fields \$CRON_JOBS \$DISK_QUOTA \$BANDWIDTH \$NS \$SHELL \$BACKUPS" +fields="$fields \$CONTACT \$CRON_REPORTS \$RKEY \$SUSPENDED \$SUSPENDED_USERS" fields="$fields \$SUSPENDED_WEB \$SUSPENDED_DNS \$SUSPENDED_MAIL" fields="$fields \$SUSPENDED_DB \$SUSPENDED_CRON \$IP_AVAIL \$IP_OWNED" fields="$fields \$U_USERS \$U_DISK \$U_DISK_DIRS \$U_DISK_WEB \$U_DISK_MAIL" diff --git a/bin/v-list-web-domain b/bin/v-list-web-domain index 480c9d839..9a8ea34d7 100755 --- a/bin/v-list-web-domain +++ b/bin/v-list-web-domain @@ -76,7 +76,7 @@ conf=$USER_DATA/web.conf # Defining fileds to select fields='$DOMAIN $IP $IP6 $U_DISK $U_BANDWIDTH $TPL $ALIAS $STATS $STATS_USER - $SSL $SSL_HOME $FTP_USER $NGINX $NGINX_EXT $SUSPENDED $TIME $DATE' + $SSL $SSL_HOME $FTP_USER $PROXY $PROXY_EXT $SUSPENDED $TIME $DATE' # Listing domains case $format in diff --git a/bin/v-list-web-domains b/bin/v-list-web-domains index ea5fac3ad..d39b7aac8 100755 --- a/bin/v-list-web-domains +++ b/bin/v-list-web-domains @@ -36,7 +36,7 @@ conf=$USER_DATA/web.conf # Defining fileds to select fields="\$DOMAIN \$IP \$IP6 \$U_DISK \$U_BANDWIDTH \$TPL \$ALIAS" fields="$fields \$STATS \$STATS_USER \$SSL \$SSL_HOME \$FTP_USER" -fields="$fields \$NGINX \$NGINX_EXT \$SUSPENDED \$TIME \$DATE" +fields="$fields \$PROXY \$PROXY_EXT \$SUSPENDED \$TIME \$DATE" # Listing domains case $format in diff --git a/bin/v-list-web-domains-nginx b/bin/v-list-web-domains-proxy similarity index 90% rename from bin/v-list-web-domains-nginx rename to bin/v-list-web-domains-proxy index 7642eb89e..d2fef4133 100755 --- a/bin/v-list-web-domains-nginx +++ b/bin/v-list-web-domains-proxy @@ -1,8 +1,8 @@ #!/bin/bash -# info: list web domains and nginx key +# info: list web domains and proxy key # options: USER [FORMAT] # -# The function for obtaining the list of domains with nginx parameter +# The function for obtaining the list of domains with proxy parameter # displayed. This call was arranged for filling in the lack of information by # applying v-list-web-domains call in the shell format. @@ -36,7 +36,7 @@ is_object_valid 'user' 'USER' "$user" conf=$USER_DATA/web.conf # Defining fileds to select -fields="\$DOMAIN \$NGINX \$NGINX_EXT" +fields="\$DOMAIN \$PROXY \$PROXY_EXT" # Listing domains case $format in diff --git a/bin/v-list-web-templates b/bin/v-list-web-templates index fa9085d0c..3ad09584c 100755 --- a/bin/v-list-web-templates +++ b/bin/v-list-web-templates @@ -2,7 +2,7 @@ # info: list web templates # options: USER [FORMAT] # -# The function for obtaining the list of apache templates available to a user. +# The function for obtaining the list of web templates available to a user. #----------------------------------------------------------# @@ -13,11 +13,12 @@ format=${1-shell} # Includes +source $VESTA/conf/vesta.conf source $VESTA/func/main.sh # Json function json_list_wtpl() { - templates=$(ls -t $WEBTPL/apache | cut -f 1 -d '.' |sort -u ) + templates=$(ls -t $WEBTPL/$WEB_SYSTEM | cut -f 1 -d '.' |sort -u ) t_counter=$(echo "$templates" | wc -w) i=1 echo '[' @@ -34,7 +35,7 @@ json_list_wtpl() { # Shell function shell_list_wtpl() { - templates=$(ls -t $WEBTPL/apache | cut -f 1 -d '.' |sort -u ) + templates=$(ls -t $WEBTPL/$WEB_SYSTEM | cut -f 1 -d '.' |sort -u ) if [ -z "$nohead" ]; then echo "Templates" echo "----------" diff --git a/bin/v-list-web-templates-nginx b/bin/v-list-web-templates-proxy similarity index 85% rename from bin/v-list-web-templates-nginx rename to bin/v-list-web-templates-proxy index e3c34fc39..9fa712070 100755 --- a/bin/v-list-web-templates-nginx +++ b/bin/v-list-web-templates-proxy @@ -1,8 +1,8 @@ #!/bin/bash -# info: listing nginx templates +# info: listing proxy templates # options: [FORMAT] # -# The function for obtaining the list of nginx templates available to a user. +# The function for obtaining the list of proxy templates available to a user. #----------------------------------------------------------# @@ -13,11 +13,11 @@ format=${1-shell} # Includes +source $VESTA/conf/vesta.conf source $VESTA/func/main.sh # Json function json_list_wtpl() { - templates=$(ls -t $WEBTPL/nginx | cut -f 1 -d '.' |sort -u ) t_counter=$(echo "$templates" | wc -w) i=1 echo '[' @@ -34,7 +34,6 @@ json_list_wtpl() { # Shell function shell_list_wtpl() { - templates=$(ls -t $WEBTPL/nginx | cut -f 1 -d '.' |sort -u ) if [ -z "$nohead" ]; then echo "Templates" echo "----------" @@ -49,6 +48,12 @@ shell_list_wtpl() { # Action # #----------------------------------------------------------# +# Proxy templates +templates=$(ls -t $WEBTPL/$PROXY_SYSTEM |\ + cut -f1 -d . |\ + grep -v proxy_ip |\ + sort -u ) + # Listing domains case $format in json) json_list_wtpl ;; diff --git a/bin/v-rebuild-web-domains b/bin/v-rebuild-web-domains index 308e72ebd..f9f7d12b9 100755 --- a/bin/v-rebuild-web-domains +++ b/bin/v-rebuild-web-domains @@ -55,64 +55,60 @@ for domain in $(shell_list); do done # Config path -httpd_conf='/etc/httpd/conf.d/vesta.conf' -nginx_conf='/etc/nginx/conf.d/vesta_users.conf' +web_conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" +proxy_conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" # Checking if there is at least 1 domain if [ "$domain_counter" -lt 1 ]; then - # Deleting web configs rm -f $HOMEDIR/$user/conf/web/* - sed -i "/.*\/$user\/.*httpd.conf/d" $httpd_conf - if [ -e "$nginx_conf" ]; then - sed -i "/.*\/$user\/.*nginx.conf/d" $nginx_conf + sed -i "/.*\/$user\/.*$WEB_SYSTEM.conf/d" $web_conf + if [ -e "$proxy_conf" ]; then + sed -i "/.*\/$user\/.*$WEB_SYSTEM.conf/d" $proxy_conf fi else - # Renaming tmp config - tmp_conf="$HOMEDIR/$user/conf/web/tmp_httpd.conf" - conf="$HOMEDIR/$user/conf/web/httpd.conf" + tmp_conf="$HOMEDIR/$user/conf/web/tmp_$WEB_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" mv $tmp_conf $conf - # Checking httpd.conf include - httpd_include=$(grep "$conf" $httpd_conf ) - if [ -z "$httpd_include" ]; then - echo "Include $conf" >> $httpd_conf + # Checking include + web_include=$(grep "$conf" $web_conf ) + if [ -z "$web_include" ]; then + echo "Include $conf" >> $web_conf fi - # Checking ssl + # Checking SSL if [ "$ssl_change" = 'yes' ]; then - tmp_conf="$HOMEDIR/$user/conf/web/tmp_shttpd.conf" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tmp_conf="$HOMEDIR/$user/conf/web/tmp_s$WEB_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" mv $tmp_conf $conf fi - - # Checking ssl include - httpd_include=$(grep "$conf" $httpd_conf ) - if [ -z "$httpd_include" ]; then - echo "Include $conf" >> $httpd_conf + ssl_include=$(grep "$conf" $web_conf ) + if [ -z "$ssl_include" ]; then + echo "Include $conf" >> $web_conf fi - # Checking nginx - if [ "$ngix_change" = 'yes' ]; then - tmp_conf="$HOMEDIR/$user/conf/web/tmp_nginx.conf" - conf="$HOMEDIR/$user/conf/web/nginx.conf" + # Checking proxy + if [ "$proxy_change" = 'yes' ]; then + tmp_conf="$HOMEDIR/$user/conf/web/tmp_$PROXY_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" mv $tmp_conf $conf fi - nginx_include=$(grep "$conf" $nginx_conf ) - if [ -z "$nginx_include" ]; then - echo "include $conf;" >> $nginx_conf + proxy_include=$(grep "$conf" $proxy_conf ) + if [ -z "$proxy_include" ]; then + echo "include $conf;" >> $proxy_conf fi - # Checking ssl for nginx - if [ "$ngix_change" = 'yes' ] && [ "$ssl_change" = 'yes' ]; then - tmp_conf="$HOMEDIR/$user/conf/web/tmp_snginx.conf" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + # Checking SSL proxy + if [ "$proxy_change" = 'yes' ] && [ "$ssl_change" = 'yes' ]; then + tmp_conf="$HOMEDIR/$user/conf/web/tmp_s$PROXY_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" mv $tmp_conf $conf - nginx_include=$(grep "$conf" $nginx_conf ) - if [ -z "$nginx_include" ]; then - echo "include $conf;" >> $nginx_conf + proxy_include=$(grep "$conf" $proxy_conf ) + if [ -z "$proxy_include" ]; then + echo "include $conf;" >> $proxy_conf fi fi fi @@ -130,7 +126,8 @@ update_user_value "$user" '$U_WEB_ALIASES' "$user_aliases" # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-restart-cron b/bin/v-restart-cron index deac9a6ad..691b41457 100755 --- a/bin/v-restart-cron +++ b/bin/v-restart-cron @@ -18,11 +18,15 @@ source $VESTA/func/main.sh # Action # #----------------------------------------------------------# -# Parsing config / or just source config -if [ "$CRON_SYSTEM" = 'crond' ]; then - /etc/init.d/crond 'reload' >/dev/null 2>&1 - if [ $? -ne 0 ]; then - /etc/init.d/crond 'restart' >/dev/null 2>&1 +if [ ! -z "$CRON_SYSTEM" ]; then + /etc/init.d/$CRON_SYSTEM status >/dev/null 2>&1 + if [ $? -eq 0 ]; then + /etc/init.d/$CRON_SYSTEM reload >/dev/null 2>&1 + if [ $? -ne 0 ]; then + exit $E_RESTART + fi + else + /etc/init.d/$CRON_SYSTEM start >/dev/null 2>&1 if [ $? -ne 0 ]; then exit $E_RESTART fi diff --git a/bin/v-restart-dns b/bin/v-restart-dns index e9cf4e572..d4392eb81 100755 --- a/bin/v-restart-dns +++ b/bin/v-restart-dns @@ -18,10 +18,15 @@ source $VESTA/func/main.sh # Action # #----------------------------------------------------------# -if [ "$DNS_SYSTEM" = 'bind' ]; then - /etc/init.d/named reload >/dev/null 2>&1 - if [ $? -ne 0 ]; then - /etc/init.d/named restart >/dev/null 2>&1 +if [ ! -z "$DNS_SYSTEM" ]; then + /etc/init.d/$DNS_SYSTEM status >/dev/null 2>&1 + if [ $? -eq 0 ]; then + /etc/init.d/$DNS_SYSTEM reload >/dev/null 2>&1 + if [ $? -ne 0 ]; then + exit $E_RESTART + fi + else + /etc/init.d/$DNS_SYSTEM start >/dev/null 2>&1 if [ $? -ne 0 ]; then exit $E_RESTART fi diff --git a/bin/v-restart-ftp b/bin/v-restart-ftp index 55d7c1f29..fb907dd98 100755 --- a/bin/v-restart-ftp +++ b/bin/v-restart-ftp @@ -18,22 +18,15 @@ source $VESTA/func/main.sh # Action # #----------------------------------------------------------# -# Vsftpd -if [ "$FTP_SYSTEM" = 'vsftpd' ]; then - /etc/init.d/vsftpd reload >/dev/null 2>&1 - if [ $? -ne 0 ]; then - /etc/init.d/vsftpd restart >/dev/null 2>&1 +if [ ! -z "$FTP_SYSTEM" ]; then + /etc/init.d/$FTP_SYSTEM status >/dev/null 2>&1 + if [ $? -eq 0 ]; then + /etc/init.d/$FTP_SYSTEM reload >/dev/null 2>&1 if [ $? -ne 0 ]; then exit $E_RESTART fi - fi -fi - -# ProFTPD -if [ "$FTP_SYSTEM" = 'proftpd' ]; then - /etc/init.d/proftpd reload >/dev/null 2>&1 - if [ $? -ne 0 ]; then - /etc/init.d/proftpd restart >/dev/null 2>&1 + else + /etc/init.d/$FTP_SYSTEM start >/dev/null 2>&1 if [ $? -ne 0 ]; then exit $E_RESTART fi diff --git a/bin/v-restart-mail b/bin/v-restart-mail index cc2a9db3c..2888ec042 100755 --- a/bin/v-restart-mail +++ b/bin/v-restart-mail @@ -18,10 +18,15 @@ source $VESTA/func/main.sh # Action # #----------------------------------------------------------# -if [ "$MAIL_SYSTEM" = 'exim' ]; then - /etc/init.d/exim reload >/dev/null 2>&1 - if [ $? -ne 0 ]; then - /etc/init.d/exim restart >/dev/null 2>&1 +if [ ! -z "$MAIL_SYSTEM" ]; then + /etc/init.d/$MAIL_SYSTEM status >/dev/null 2>&1 + if [ $? -eq 0 ]; then + /etc/init.d/$MAIL_SYSTEM reload >/dev/null 2>&1 + if [ $? -ne 0 ]; then + exit $E_RESTART + fi + else + /etc/init.d/$MAIL_SYSTEM start >/dev/null 2>&1 if [ $? -ne 0 ]; then exit $E_RESTART fi diff --git a/bin/v-restart-proxy b/bin/v-restart-proxy new file mode 100755 index 000000000..3f7311faf --- /dev/null +++ b/bin/v-restart-proxy @@ -0,0 +1,41 @@ +#!/bin/bash +# info: restart proxy server +# options: NONE +# +# The function reloads proxy server configuration. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Includes +source $VESTA/conf/vesta.conf +source $VESTA/func/main.sh + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +if [ ! -z "$PROXY_SYSTEM" ]; then + /etc/init.d/$PROXY_SYSTEM status >/dev/null 2>&1 + if [ $? -eq 0 ]; then + /etc/init.d/$PROXY_SYSTEM reload >/dev/null 2>&1 + if [ $? -ne 0 ]; then + exit $E_RESTART + fi + else + /etc/init.d/$PROXY_SYSTEM start >/dev/null 2>&1 + if [ $? -ne 0 ]; then + exit $E_RESTART + fi + fi +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-restart-web b/bin/v-restart-web index 1c71d90b4..abfa58035 100755 --- a/bin/v-restart-web +++ b/bin/v-restart-web @@ -1,5 +1,5 @@ #!/bin/bash -# info: restart web services +# info: restart web server # options: NONE # # The function reloads web server configuration. @@ -18,37 +18,21 @@ source $VESTA/func/main.sh # Action # #----------------------------------------------------------# -if [ "$WEB_SYSTEM" = 'apache' ]; then - /etc/init.d/httpd status >/dev/null 2>&1 +if [ ! -z "$WEB_SYSTEM" ]; then + /etc/init.d/$WEB_SYSTEM status >/dev/null 2>&1 if [ $? -eq 0 ]; then - /etc/init.d/httpd graceful >/dev/null 2>&1 + /etc/init.d/$WEB_SYSTEM reload >/dev/null 2>&1 if [ $? -ne 0 ]; then exit $E_RESTART fi else - /etc/init.d/httpd start >/dev/null 2>&1 + /etc/init.d/$WEB_SYSTEM start >/dev/null 2>&1 if [ $? -ne 0 ]; then exit $E_RESTART fi fi fi -if [ "$PROXY_SYSTEM" = 'nginx' ]; then - /etc/init.d/nginx status >/dev/null 2>&1 - if [ $? -eq 0 ]; then - /etc/init.d/nginx reload >/dev/null 2>&1 - if [ $? -ne 0 ]; then - exit $E_RESTART - fi - else - /etc/init.d/nginx start >/dev/null 2>&1 - if [ $? -ne 0 ]; then - exit $E_RESTART - fi - fi - -fi - #----------------------------------------------------------# # Vesta # diff --git a/bin/v-restore-user b/bin/v-restore-user index 965714b51..114504159 100755 --- a/bin/v-restore-user +++ b/bin/v-restore-user @@ -244,21 +244,11 @@ if [ "$web" != 'no' ]; then echo "$IP" > $tmpdir/ip_mapping.$domain fi - # Check apache template - check_tpl=$(is_apache_template_valid) - if [ ! -z "$check_tpl" ]; then - templates=$(ls -t $VESTA/data/templates/web/ |\ - grep 'apache' |\ - grep '\.tpl' |\ - cut -f 2 -d '_' |\ - cut -f 1 -d '.') - if [ ! -z "$(echo $templates |grep default)" ]; then - TPL=$(echo "$templates" |grep default |head -n1) - else - TPL=$("$templates" |head -n1) - fi - - if [ -z "$TPL" ]; then + # Check web template + check_tpl=$(is_web_template_valid) + if [ ! -e "$WEBTPL/$WEB_SYSTEM/$TPL.tpl" ]; then + TPL="default" + if [ ! -e "$WEBTPL/$WEB_SYSTEM/$TPL.tpl" ]; then echo "Error: no avaiable web template" echo "No available web template" |\ $send_mail -s "$subj" $email @@ -267,24 +257,13 @@ if [ "$web" != 'no' ]; then fi fi - # Check nginx template - if [ ! -z "$NGINX" ]; then - check_tpl=$(is_nginx_template_valid) - if [ ! -z "$check_tpl" ]; then - templates=$(ls -t $VESTA/data/templates/web/ |\ - grep 'nginx' |\ - grep '\.tpl' |\ - cut -f 2 -d '_' |\ - cut -f 1 -d '.') - if [ ! -z "$(echo $templates |grep default)" ]; then - NGINX=$(echo "$templates" |grep default |head -n1) - else - NGINX=$("$templates" |head -n1) - fi - - if [ -z "$NGINX" ]; then - echo "Error: no avaiable nginx template" - echo "No available nginx tpl" |\ + # Check proxy template + if [ ! -z "$PROXY" ]; then + if [ ! -e "$WEBTPL/$PROXY_SYSTEM/$TPL.tpl" ]; then + PROXY="default" + if [ ! -e "$WEBTPL/$PROXY_SYSTEM/$TPL.tpl" ]; then + echo "Error: no avaiable proxy template" + echo "No available proxy tpl" |\ $send_mail -s "$subj" $email log_event "$E_NOTEXIST" "$EVENT" exit $E_NOTEXIST @@ -302,8 +281,8 @@ if [ "$web" != 'no' ]; then str="DOMAIN='$domain' IP='$IP' IP6='$IP6' ALIAS='$ALIAS'" str="$str TPL='$TPL' SSL='$SSL' SSL_HOME='$SSL_HOME'" - str="$str FTP_USER='$FTP_USER' FTP_MD5='$FTP_MD5' NGINX='$NGINX'" - str="$str NGINX_EXT='$NGINX_EXT' STATS='$STATS'" + str="$str FTP_USER='$FTP_USER' FTP_MD5='$FTP_MD5' PROXY='$PROXY'" + str="$str PROXY_EXT='$PROXY_EXT' STATS='$STATS'" str="$str STATS_USER='$STATS_USER' STATS_CRYPT='$STATS_CRYPT'" str="$str U_DISK='$U_DISK' U_BANDWIDTH='0' SUSPENDED='no'" str="$str TIME='$(date +%T)' DATE='$(date +%F)'" @@ -312,51 +291,51 @@ if [ "$web" != 'no' ]; then # Rebuild web config rebuild_web_domain_conf - # Adding apache virtualhost - httpd_conf='/etc/httpd/conf.d/vesta.conf' - tmp_conf="$HOMEDIR/$user/conf/web/tmp_httpd.conf" - conf="$HOMEDIR/$user/conf/web/httpd.conf" + # Adding vhost + web_conf="/etc/$WEB_SYSTEM/conf.d/vesta.conf" + tmp_conf="$HOMEDIR/$user/conf/web/tmp_$WEB_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" cat $tmp_conf >> $conf rm -f $tmp_conf - httpd_include=$(grep "$conf" $httpd_conf ) - if [ -z "$httpd_include" ]; then - echo "Include $conf" >> $httpd_conf + web_include=$(grep "$conf" $web_conf) + if [ -z "$web_include" ]; then + echo "Include $conf" >> $web_conf fi - # Adding ssl apache virtuualhost + # Adding SSL vhost if [ "$ssl_change" = 'yes' ]; then - tmp_conf="$HOMEDIR/$user/conf/web/tmp_shttpd.conf" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tmp_conf="$HOMEDIR/$user/conf/web/tmp_s$WEB_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" cat $tmp_conf >> $conf rm -f $tmp_conf fi - httpd_include=$(grep "$conf" $httpd_conf ) - if [ -z "$httpd_include" ]; then - echo "Include $conf" >> $httpd_conf + ssl_include=$(grep "$conf" $web_conf) + if [ -z "$ssl_include" ]; then + echo "Include $conf" >> $web_conf fi - # Adding nginx virtualhost - nginx_conf='/etc/nginx/conf.d/vesta_users.conf' - if [ "$ngix_change" = 'yes' ]; then - tmp_conf="$HOMEDIR/$user/conf/web/tmp_nginx.conf" - conf="$HOMEDIR/$user/conf/web/nginx.conf" + # Adding proxy vhost + proxy_conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf" + if [ "$proxy_change" = 'yes' ]; then + tmp_conf="$HOMEDIR/$user/conf/web/tmp_$PROXY_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" cat $tmp_conf >> $conf rm -f $tmp_conf fi - nginx_include=$(grep "$conf" $nginx_conf ) - if [ -z "$nginx_include" ]; then - echo "include $conf;" >> $nginx_conf + proxy_include=$(grep "$conf" $proxy_conf) + if [ -z "$proxy_include" ]; then + echo "include $conf;" >> $proxy_conf fi - # Adding ssl nginx virtualhost - if [ "$ngix_change" = 'yes' ] && [ "$ssl_change" = 'yes' ]; then - tmp_conf="$HOMEDIR/$user/conf/web/tmp_snginx.conf" - conf="$HOMEDIR/$user/conf/web/snginx.conf" + # Adding SSL proxy vhost + if [ "$proxy_change" = 'yes' ] && [ "$ssl_change" = 'yes' ]; then + tmp_conf="$HOMEDIR/$user/conf/web/tmp_s$PROXY_SYSTEM.conf" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" cat $tmp_conf >> $conf rm -f $tmp_conf - nginx_include=$(grep "$conf" $nginx_conf ) - if [ -z "$nginx_include" ]; then - echo "include $conf;" >> $nginx_conf + proxy_include=$(grep "$conf" $proxy_conf) + if [ -z "$proxy_include" ]; then + echo "include $conf;" >> $proxy_conf fi fi fi @@ -380,7 +359,8 @@ if [ "$web" != 'no' ]; then done # Restart WEB - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy echo msg="$msg\n" fi diff --git a/bin/v-suspend-web-domain b/bin/v-suspend-web-domain index 9e915ad6c..c3f6052b1 100755 --- a/bin/v-suspend-web-domain +++ b/bin/v-suspend-web-domain @@ -42,8 +42,8 @@ is_object_unsuspended 'web' 'DOMAIN' "$domain" # Parsing domain values get_domain_values 'web' -tpl_file="$WEBTPL/apache/$TPL.tpl" -conf="$HOMEDIR/$user/conf/web/httpd.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" SUSPENDED='yes' ip=$(get_real_ip $IP) @@ -54,27 +54,29 @@ upd_web_domain_values del_web_config add_web_config -# Check ssl +# Check SSL if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" del_web_config add_web_config fi -# Checking nginx -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/nginx.conf" +# Checking proxy +if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" del_web_config add_web_config - if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" - del_web_config - add_web_config - fi +fi + +# Checking proxy SSL +if [ ! -z "$PROXY" ] && [ "$SSL" = 'yes' ]; then + tpl_file="$WEBTPL/$PROXY_SSL/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" + del_web_config + add_web_config fi @@ -88,7 +90,8 @@ increase_user_value "$user" '$SUSPENDED_WEB' # Restart web server if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-unsuspend-web-domain b/bin/v-unsuspend-web-domain index 822dbc461..09b1c3ad7 100755 --- a/bin/v-unsuspend-web-domain +++ b/bin/v-unsuspend-web-domain @@ -40,8 +40,8 @@ is_object_suspended 'web' 'DOMAIN' "$domain" # Parsing domain values get_domain_values 'web' -tpl_file="$WEBTPL/apache/$TPL.tpl" -conf="$HOMEDIR/$user/conf/web/httpd.conf" +tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" +conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" SUSPENDED='no' ip=$(get_real_ip $IP) @@ -52,27 +52,28 @@ upd_web_domain_values del_web_config add_web_config -# Check ssl +# Check SSL if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/apache/$TPL.stpl" - conf="$HOMEDIR/$user/conf/web/shttpd.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" + conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf" del_web_config add_web_config fi -# Checking nginx -if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/nginx.conf" +# Checking proxy +if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" del_web_config add_web_config +fi - if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/snginx.conf" - del_web_config - add_web_config - fi +# Checking SSL proxy +if [ ! -z "$PROXY" ] && [ "$SSL" = 'yes' ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" + del_web_config + add_web_config fi @@ -86,7 +87,8 @@ decrease_user_value "$user" '$SUSPENDED_WEB' # Restart web erver if [ "$restart" != 'no' ]; then - $BIN/v-restart-web "$EVENT" + $BIN/v-restart-web + $BIN/v-restart-proxy fi # Logging diff --git a/bin/v-update-sys-ip b/bin/v-update-sys-ip index da5bca6f3..8829aff70 100755 --- a/bin/v-update-sys-ip +++ b/bin/v-update-sys-ip @@ -16,10 +16,8 @@ user=${1-admin} ip_status=${2-shared} # Includes -source $VESTA/conf/vesta.conf # include for internal func +source $VESTA/conf/vesta.conf source $VESTA/func/main.sh -source $VESTA/func/ip.sh -source $VESTA/func/domain.sh #----------------------------------------------------------# @@ -35,40 +33,15 @@ is_object_valid 'user' 'USER' "$user" "$user" # Action # #----------------------------------------------------------# -# Get ip list ip_list=$(/sbin/ifconfig | grep 'inet addr:' | cut -f 2 -d : | \ cut -f 1 -d ' '| grep -v 127.0.0.1) -# Get vesta registered ip list -vesta_ip_list=$(ls $VESTA/data/ips/) - -# Defining config paths -conf='/etc/httpd/conf.d/vesta.conf' -nconf='/etc/nginx/conf.d/vesta_ip.conf' -iconf='/etc/sysconfig/network-scripts/ifcfg' -rconf='/etc/httpd/conf.d/mod_extract_forwarded.conf' - -# Comparing each ip for ip in $ip_list; do - check_ip=$(echo $vesta_ip_list | grep -w "$ip") - - # Checking ip registered - if [ -z "$check_ip" ]; then - # Parsing additional params - iface=$(/sbin/ifconfig |grep -B1 -w $ip |head -n 1 |cut -f 1 -d ' ') + if [ ! -e "$VESTA/data/ips/$ip" ]; then + iface=$(/sbin/ifconfig |grep -B1 -w $ip |head -n1 |cut -f1 -d ' ') interface=$(echo "$iface" | cut -f 1 -d :) mask=$(/sbin/ifconfig |grep -w $ip |awk -F "Mask:" '{print $2}') - - # Adding vesta ip - create_vesta_ip - - # Adding namehosting support - namehost_ip_support - - # Creating startup script - if [ ! -e "$iconf-$iface" ]; then - create_vesta_ip - fi + $BIN/v-add-sys-ip $ip $mask $interface fi # TBD: revers comparation @@ -79,15 +52,4 @@ done # Vesta # #----------------------------------------------------------# -# Updating user conf -increase_user_value "$user" '$IP_OWNED' - -# Restart web server -if [ "$web_restart" = 'yes' ]; then - $BIN/v-restart-web "$EVENT" -fi - -# Logging -log_event "$OK" "$EVENT" - exit diff --git a/bin/v-update-sys-rrd b/bin/v-update-sys-rrd index 8b6aba36b..ad25f923c 100755 --- a/bin/v-update-sys-rrd +++ b/bin/v-update-sys-rrd @@ -102,12 +102,12 @@ for period in $periods; do $BIN/v-update-sys-rrd-ssh $period # Updating web stats - if [ "$WEB_SYSTEM" = 'apache' ]; then - $BIN/v-update-sys-rrd-httpd $period + if [ ! -z "$WEB_SYSTEM" ]; then + $BIN/v-update-sys-rrd-$WEB_SYSTEM $period fi - if [ "$PROXY_SYSTEM" = 'nginx' ]; then - $BIN/v-update-sys-rrd-nginx $period + if [ ! -z "$PROXY_SYSTEM" ]; then + $BIN/v-update-sys-rrd-$PROXY_SYSTEM $period fi # Updating ftp stats diff --git a/bin/v-update-web-domain-traff b/bin/v-update-web-domain-traff index 5bfb6d387..38c0506ee 100755 --- a/bin/v-update-web-domain-traff +++ b/bin/v-update-web-domain-traff @@ -38,7 +38,7 @@ is_object_unsuspended 'web' 'DOMAIN' "$domain" #----------------------------------------------------------# # Defining log file -log_file="/var/log/httpd/domains/$domain.bytes" +log_file="/var/log/$WEB_SYSTEM/domains/$domain.bytes" # Defining bytes bytes=0 diff --git a/bin/v-update-web-domains-traff b/bin/v-update-web-domains-traff index a72e8b4ce..cc19ed4e5 100755 --- a/bin/v-update-web-domains-traff +++ b/bin/v-update-web-domains-traff @@ -38,7 +38,7 @@ for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' '0' fi - log_file="/var/log/httpd/domains/$domain.bytes" + log_file="/var/log/$WEB_SYSTEM/domains/$domain.bytes" bytes=0 # Parsing log diff --git a/func/domain.sh b/func/domain.sh index ec888d100..44b28be40 100644 --- a/func/domain.sh +++ b/func/domain.sh @@ -1,46 +1,32 @@ # Web template check -is_apache_template_valid() { - t="$WEBTPL/apache/$template.tpl" - s="$WEBTPL/apache/$template.stpl" +is_web_template_valid() { + t="$WEBTPL/$WEB_SYSTEM/$template.tpl" + s="$WEBTPL/$WEB_SYSTEM/$template.stpl" if [ ! -e $t ] || [ ! -e $s ]; then - template='default' - t="$WEBTPL/apache/$template.tpl" - s="$WEBTPL/apache/$template.stpl" - if [ ! -e $t ] || [ ! -e $s ]; then - echo "Error: template $template not found" - log_event "$E_NOTEXIST" "$EVENT" - exit $E_NOTEXIST - fi + echo "Error: web template $template not found" + log_event "$E_NOTEXIST" "$EVENT" + exit $E_NOTEXIST fi } -# Nginx template check -is_nginx_template_valid() { - t="$WEBTPL/nginx/$template.tpl" - s="$WEBTPL/nginx/$template.stpl" +# Proxy template check +is_proxy_template_valid() { + t="$WEBTPL/$PROXY_SYSTEM/$template.tpl" + s="$WEBTPL/$PROXY_SYSTEM/$template.stpl" if [ ! -e $t ] || [ ! -e $s ]; then - template='default' - t="$WEBTPL/nginx/$template.tpl" - s="$WEBTPL/nginx/$template.stpl" - if [ ! -e $t ] || [ ! -e $s ]; then - echo "Error: nginx $template not found" - log_event "$E_NOTEXIST" "$EVENT" - exit $E_NOTEXIST - fi + echo "Error: proxy template $template not found" + log_event "$E_NOTEXIST" "$EVENT" + exit $E_NOTEXIST fi } # DNS template check is_dns_template_valid() { - tpl="$DNSTPL/$template.tpl" - if [ ! -e $tpl ]; then - template='default' - tpl="$DNSTPL/$template.tpl" - if [ ! -e $tpl ]; then - echo "Error: template not found" - log_event "$E_NOTEXIST" "$EVENT" - exit $E_NOTEXIST - fi + t="$DNSTPL/$template.tpl" + if [ ! -e $t ]; then + echo "Error: dns template $template not found" + log_event "$E_NOTEXIST" "$EVENT" + exit $E_NOTEXIST fi } @@ -239,6 +225,7 @@ add_web_config() { -e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \ -e "s/%proxy_port%/$PROXY_PORT/g" \ -e "s/%proxy_ssl_port%/$PROXY_SSL_PORT/g" \ + -e "s/%proxy_extentions%/${PROXY_EXT//,/|}/g" \ -e "s/%domain_idn%/$domain_idn/g" \ -e "s/%domain%/$domain/g" \ -e "s/%user%/$user/g" \ @@ -255,10 +242,6 @@ add_web_config() { -e "s/%ssl_pem%/${ssl_pem////\/}/g" \ -e "s/%ssl_ca_str%/${ssl_ca_str////\/}/g" \ -e "s/%ssl_ca%/${ssl_ca////\/}/g" \ - -e "s/%nginx_extentions%/${NGINX_EXT//,/|}/g" \ - -e "s/%elog%//g" \ - -e "s/%cgi%//g" \ - -e "s/%cgi_option%/+ExecCGI/g" \ >> $conf } @@ -397,71 +380,6 @@ del_web_config() { sed -i "$top_line,$bottom_line d" $conf } -# Add ip virtual hosting support -namehost_ip_support() { - if [ "$WEB_SYSTEM" = 'apache' ]; then - conf_line=$(grep -n "NameVirtual" $conf|tail -n 1|cut -f 1 -d ':') - if [ ! -z "$conf_line" ]; then - conf_ins=$((conf_line + 1)) - else - conf_ins='1' - fi - - if [ "$WEB_SSL" = 'mod_ssl' ]; then - sed -i "$conf_ins i NameVirtualHost $ip:$WEB_SSL_PORT" $conf - sed -i "$conf_ins i Listen $ip:$WEB_SSL_PORT" $conf - fi - - sed -i "$conf_ins i NameVirtualHost $ip:$WEB_PORT" $conf - sed -i "$conf_ins i Listen $ip:$WEB_PORT" $conf - - if [ "$PROXY_SYSTEM" = 'nginx' ]; then - cat $WEBTPL/nginx/ip.tpl | sed -e "s/%ip%/$ip/g" \ - -e "s/%web_port%/$WEB_PORT/g" \ - -e "s/%proxy_port%/$PROXY_PORT/g" >>$nconf - - ips=$(grep 'MEFaccept ' $rconf |grep -v '#'| head -n1) - sed -i "s/$ips/$ips $ip/g" $rconf - fi - web_restart='yes' - fi -} - -# Disable virtual ip hosting support -namehost_ip_disable() { - if [ "$WEB_SYSTEM" = 'apache' ]; then - sed -i "/NameVirtualHost $ip:/d" $conf - sed -i "/Listen $ip:/d" $conf - - if [ "$PROXY_SYSTEM" = 'nginx' ]; then - tpl_ln=$(wc -l $WEBTPL/nginx/ip.tpl | cut -f 1 -d ' ') - ip_line=$(grep -n "%ip%" $WEBTPL/nginx/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" ] - then - echo "Error: nginx config paring error" - log_event "$E_PARSING" "$EVENT" - exit $E_PARSING - fi - up_line=$((ip_line - 1)) - first_line=$((conf_line - up_line)) - last_line=$((conf_line - ip_line + tpl_ln)) - - if [ -z "$first_line" ] || [ -z "$last_line" ]; then - echo "Error: nginx config paring error" - log_event "$E_PARSING" "$EVENT" - exit $E_PARSING - fi - sed -i "$first_line,$last_line d" $nconf - ips=$(grep 'RPAFproxy_ips' $rconf) - new_ips=$(echo "$ips"|sed -e "s/$ip//") - sed -i "s/$ips/$new_ips/g" $rconf - fi - web_restart='yes' - fi -} - # Update web domain values upd_web_domain_values() { group="$user" diff --git a/func/ip.sh b/func/ip.sh index aa542f63a..f8ec8137a 100644 --- a/func/ip.sh +++ b/func/ip.sh @@ -45,9 +45,7 @@ is_ip_owner() { # Check if ip address is free is_ip_free() { - list=$(/sbin/ifconfig |grep 'inet addr:' |cut -f 2 -d : |cut -f 1 -d ' ') - ip_check=$(echo "$list" |grep -w "$ip") - if [ -n "$ip_check" ] || [ -e "$VESTA/data/ips/$ip" ]; then + if [ -e "$VESTA/data/ips/$ip" ]; then echo "Error: IP exist" log_event "$E_EXISTS" "$EVENT" exit $E_EXISTS @@ -174,30 +172,6 @@ get_ip_value() { echo "$value" } -# Create ip vesta configuration -create_vesta_ip() { - ip_data="OWNER='$user'" - ip_data="$ip_data\nSTATUS='$ip_status'" - ip_data="$ip_data\nNAME='$ip_name'" - ip_data="$ip_data\nU_SYS_USERS=''" - ip_data="$ip_data\nU_WEB_DOMAINS='0'" - ip_data="$ip_data\nINTERFACE='$interface'" - ip_data="$ip_data\nNETMASK='$mask'" - ip_data="$ip_data\nNAT='$nat_ip'" - ip_data="$ip_data\nTIME='$TIME'" - ip_data="$ip_data\nDATE='$DATE'" - echo -e "$ip_data" >$VESTA/data/ips/$ip - chmod 660 $VESTA/data/ips/$ip -} - -# Create ip address startup configuration -create_ip_startup() { - ip_data="# Added by vesta $SCRIPT\nDEVICE=$iface" - ip_data="$ip_data\nBOOTPROTO=static\nONBOOT=yes\nIPADDR=$ip" - ip_data="$ip_data\nNETMASK=$mask" - echo -e "$ip_data" > $iconf-$iface -} - # Get real ip address get_real_ip() { if [ -e "$VESTA/data/ips/$1" ]; then diff --git a/func/main.sh b/func/main.sh index ec99ec523..b3658aa9b 100644 --- a/func/main.sh +++ b/func/main.sh @@ -209,7 +209,7 @@ is_object_valid() { fi fi if [ -z "$sobject" ]; then - echo "Error: $3 not exist" + echo "Error: $2 $3 not exist" log_event "$E_NOTEXIST" "$EVENT" exit $E_NOTEXIST fi @@ -684,7 +684,7 @@ validate_format_mhdmw() { fi } -# Nginx static extention or DNS record +# proxy extention or DNS record validate_format_common() { exclude="[!|#|$|^|&|(|)|+|=|{|}|:|<|>|?|/|\|\"|'|;|%|\`| ]" if [[ "$1" =~ $exclude ]] || [ 200 -le ${#1} ]; then diff --git a/func/rebuild.sh b/func/rebuild.sh index a00fbbbc1..f69e109e5 100644 --- a/func/rebuild.sh +++ b/func/rebuild.sh @@ -156,14 +156,14 @@ rebuild_web_domain_conf() { $HOMEDIR/$user/web/$domain/logs # Create domain logs - touch /var/log/httpd/domains/$domain.bytes \ - /var/log/httpd/domains/$domain.log \ - /var/log/httpd/domains/$domain.error.log + touch /var/log/$WEB_SYSTEM/domains/$domain.bytes \ + /var/log/$WEB_SYSTEM/domains/$domain.log \ + /var/log/$WEB_SYSTEM/domains/$domain.error.log # Create symlinks cd $HOMEDIR/$user/web/$domain/logs/ - ln -f -s /var/log/httpd/domains/$domain.log . - ln -f -s /var/log/httpd/domains/$domain.error.log . + ln -f -s /var/log/$WEB_SYSTEM/domains/$domain.log . + ln -f -s /var/log/$WEB_SYSTEM/domains/$domain.error.log . cd - > /dev/null # Propagate html skeleton @@ -180,7 +180,7 @@ rebuild_web_domain_conf() { chmod 751 $HOMEDIR/$user/web/$domain/document_errors chmod 551 $HOMEDIR/$user/web/$domain/stats chmod 551 $HOMEDIR/$user/web/$domain/logs - chmod 640 /var/log/httpd/domains/$domain.* + chmod 640 /var/log/$WEB_SYSTEM/domains/$domain.* # Set ownership chown $user:$user $HOMEDIR/$user/web/$domain @@ -189,19 +189,18 @@ rebuild_web_domain_conf() { chown $user:$user $HOMEDIR/$user/web/$domain/public_html chown $user:$user $HOMEDIR/$user/web/$domain/public_shtml chown -R $user:$user $HOMEDIR/$user/web/$domain/document_errors - chown root:$user /var/log/httpd/domains/$domain.* + chown root:$user /var/log/$WEB_SYSTEM/domains/$domain.* - - # Adding tmp_httpd.conf - tpl_file="$WEBTPL/apache/$TPL.tpl" - conf="$HOMEDIR/$user/conf/web/tmp_httpd.conf" + # Adding tmp conf + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.tpl" + conf="$HOMEDIR/$user/conf/web/tmp_$WEB_SYSTEM.conf" add_web_config - chown root:apache $conf + chown root:$user $conf chmod 640 $conf # Running template trigger - if [ -x $WEBTPL/apache/$TPL.sh ]; then - $WEBTPL/apache/$TPL.sh $user $domain $ip $HOMEDIR $docroot + if [ -x $WEBTPL/$WEB_SYSTEM/$TPL.sh ]; then + $WEBTPL/$WEB_SYSTEM/$TPL.sh $user $domain $ip $HOMEDIR $docroot fi # Checking aliases @@ -253,13 +252,13 @@ rebuild_web_domain_conf() { fi fi - # Checking ssl + # Checking SSL if [ "$SSL" = 'yes' ]; then - # Adding domain to the shttpd.conf - conf="$HOMEDIR/$user/conf/web/tmp_shttpd.conf" - tpl_file="$WEBTPL/apache/$TPL.stpl" + # Adding domain to the web conf + conf="$HOMEDIR/$user/conf/web/tmp_s$WEB_SYSTEM.conf" + tpl_file="$WEBTPL/$WEB_SYSTEM/$TPL.stpl" add_web_config - chown root:apache $conf + chown root:$user $conf chmod 640 $conf cp -f $USER_DATA/ssl/$domain.crt \ @@ -274,30 +273,30 @@ rebuild_web_domain_conf() { fi # Running template trigger - if [ -x $WEBTPL/apache/$TPL.sh ]; then - $WEBTPL/apache/$TPL.sh $user $domain $ip $HOMEDIR $sdocroot + if [ -x $WEBTPL/$WEB_SYSTEM/$TPL.sh ]; then + $WEBTPL/$WEB_SYSTEM/$TPL.sh $user $domain $ip $HOMEDIR $sdocroot fi user_ssl=$((user_ssl + 1)) ssl_change='yes' fi - # Checking nginx - if [ ! -z "$NGINX" ]; then - tpl_file="$WEBTPL/nginx/$NGINX.tpl" - conf="$HOMEDIR/$user/conf/web/tmp_nginx.conf" + # Checking proxy + if [ ! -z "$PROXY" ]; then + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" + conf="$HOMEDIR/$user/conf/web/tmp_$PROXY_SYSTEM.conf" add_web_config - chown root:nginx $conf + chown root:$user $conf chmod 640 $conf if [ "$SSL" = 'yes' ]; then - tpl_file="$WEBTPL/nginx/$NGINX.stpl" - conf="$HOMEDIR/$user/conf/web/tmp_snginx.conf" + tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" + conf="$HOMEDIR/$user/conf/web/tmp_s$PROXY_SYSTEM.conf" add_web_config - chown root:nginx $conf + chown root:$user $conf chmod 640 $conf fi - ngix_change='yes' + proxy_change='yes' fi if [ "$SUSPENDED" = 'yes' ]; then suspended_web=$((suspended_web + 1)) diff --git a/upd/convert-templates.sh b/upd/convert-templates.sh index 72d626a7f..30dcf2bba 100755 --- a/upd/convert-templates.sh +++ b/upd/convert-templates.sh @@ -1,29 +1,71 @@ #!/bin/bash -# Define data path -TPL='/usr/local/vesta/data/templates/web' +# Rename web system service +sed -i "s/apache/httpd/g" /usr/local/vesta/conf/vesta.conf -# Check for new template structure +# Rename dns system service +sed -i "s/bind/named/g" /usr/local/vesta/conf/vesta.conf + +# Rename nginx config +mv /etc/nginx/conf.d/vesta_users.conf /etc/nginx/conf.d/vesta.conf 2>/dev/null +rm -f /etc/nginx/conf.d/vesta_ip.conf 2>/dev/null + +# Update user packages +PKG=/usr/local/vesta/data/packages +for package in $(ls $PKG); do + default=$(grep "^TEMPLATE='" $PKG/$package | cut -f2 -d \') + if [ ! -z "$default" ]; then + tpl="WEB_TEMPLATE='$default'" + tpl="$tpl\nPROXY_TEMPLATE='default'" + tpl="$tpl\nDNS_TEMPLATE='default'" + sed -i "s/^TEMPLATE=.*/$tpl/g" $PKG/$package + fi +done + +# Update users +USR=/usr/local/vesta/data/users +for user in $(ls $USR); do + default=$(grep "^TEMPLATE='" $USR/$user/user.conf | cut -f2 -d \') + if [ ! -z "$default" ]; then + tpl="WEB_TEMPLATE='$default'" + tpl="$tpl\nPROXY_TEMPLATE='default'" + tpl="$tpl\nDNS_TEMPLATE='default'" + sed -i "s/^TEMPLATE=.*/$tpl/g" $USR/$user/user.conf + fi +done + +# Rename NGINX to PROXY key +sed -i "s/NGINX/PROXY/g" /usr/local/vesta/data/users/*/web.conf + +# Check template structure +TPL='/usr/local/vesta/data/templates/web' if [ -e "$TPL/apache" ]; then - exit + mv $TPL/apache $TPL/httpd fi # Remove unused email template -rm -f $TPL/email_reset_password.tpl - -# Apache -mkdir -p $TPL/apache -if [ ! -z "$(ls $TPL/| grep apache_)" ];then - mv $TPL/apache_* $TPL/apache/ - for template in $(ls $TPL/apache/); do - new_name=$(echo $template |sed -e "s/apache_//") - mv -f $TPL/apache/$template $TPL/apache/$new_name - done +if [ -e $TPL/email_reset_password.tpl ]; then + rm -f $TPL/email_reset_password.tpl fi -# Nginx -mkdir -p $TPL/nginx +# Update httpd templates +if [ ! -z "$(ls $TPL | grep apache_)" ]; then + mkdir -p $TPL/httpd + mv $TPL/apache_* $TPL/httpd/ + for template in $(ls $TPL/httpd); do + new_name=$(echo $template | sed -e "s/apache_//") + mv -f $TPL/httpd/$template $TPL/httpd/$new_name + done +fi +if [ -e "$TPL/httpd" ]; then + sed -i -e "s/%elog%//g" \ + -e "s/%cgi%//g" \ + -e "s/%cgi_option%/+ExecCGI/g" $TPL/httpd/* +fi + +# Update nginx templates if [ ! -z "$(ls $TPL/| grep nginx_)" ];then + mkdir -p $TPL/nginx mv $TPL/nginx_* $TPL/nginx/ for template in $(ls $TPL/nginx/); do new_name=$(echo $template |sed -e "s/nginx_//") @@ -31,21 +73,38 @@ if [ ! -z "$(ls $TPL/| grep nginx_)" ];then done fi if [ -e "$TPL/ngingx.ip.tpl" ]; then - mv $TPL/ngingx.ip.tpl $TPL/nginx/ip.tpl + mv $TPL/ngingx.ip.tpl $TPL/nginx/proxy_ip.tpl +fi +if [ -e "$TPL/nginx/ip.tpl" ]; then + mv $TPL/nginx/ip.tpl $TPL/nginx/proxy_ip.tpl +fi +if [ -e "$TPL/nginx" ]; then + sed -i -e "s/%elog%//g" \ + -e "s/nginx_extentions/proxy_extentions/g" $TPL/nginx/* fi -# Awstats -mkdir -p $TPL/awstats +# Move Awstats templates if [ -e "$TPL/awstats.tpl" ]; then + mkdir -p $TPL/awstats mv $TPL/awstats.tpl $TPL/awstats mv $TPL/awstats_index.tpl $TPL/awstats/index.tpl mv $TPL/awstats_nav.tpl $TPL/awstats/nav.tpl fi -# Webalizer -mkdir -p $TPL/webalizer +# Move Webalizer templates if [ -e "$TPL/webalizer.tpl" ]; then + mkdir -p $TPL/webalizer mv $TPL/webalizer.tpl $TPL/webalizer fi +# Update proxy ip configuration +for ip in $(ls /usr/local/vesta/data/ips); do + cat $TPL/nginx/proxy_ip.tpl |\ + sed -e "s/%ip%/$ip/g" \ + -e "s/%web_port%/8080/g" \ + -e "s/%proxy_port%/80/g" \ + > /etc/nginx/conf.d/$ip.conf +done + + exit diff --git a/web/add/dns/index.php b/web/add/dns/index.php index fdf1e1b46..3bb83f700 100644 --- a/web/add/dns/index.php +++ b/web/add/dns/index.php @@ -21,11 +21,6 @@ if (!empty($_POST['ok'])) { $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']); $v_domain = escapeshellarg($v_domain); $v_ip = escapeshellarg($_POST['v_ip']); - if ($_SESSION['user'] == 'admin') { - $v_template = escapeshellarg($_POST['v_template']); - } else { - $v_template = "''"; - } if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']); if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']); @@ -44,7 +39,7 @@ if (!empty($_POST['ok'])) { $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); } else { // Add DNS - exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $output, $return_var); + exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $output, $return_var); if ($return_var != 0) { $error = implode('
', $output); if (empty($error)) $error = __('Error code:',$return_var); @@ -128,15 +123,7 @@ if (!empty($_POST['ok_rec'])) { } } - if ((empty($_GET['domain'])) && (empty($_POST['domain']))) { - exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var); - $template = $output[0] ; - unset($output); - exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); - $templates = json_decode(implode('', $output), true); - unset($output); - if ((empty($v_ns1)) && (empty($v_ns2))) { exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var); $nameservers = json_decode(implode('', $output), true); diff --git a/web/add/package/index.php b/web/add/package/index.php index 69cc88b31..646ebc0c3 100644 --- a/web/add/package/index.php +++ b/web/add/package/index.php @@ -21,7 +21,9 @@ if ($_SESSION['user'] == 'admin') { if (!empty($_POST['ok'])) { // Check input if (empty($_POST['v_package'])) $errors[] = __('package'); - if (empty($_POST['v_template'])) $errors[] = __('template'); + if (empty($_POST['v_web_template'])) $errors[] = __('web template'); + if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template'); + if (empty($_POST['v_dns_template'])) $errors[] = __('dns template'); if (empty($_POST['v_shell'])) $errrors[] = __('shell'); if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains'); if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases'); @@ -40,7 +42,9 @@ if ($_SESSION['user'] == 'admin') { // Protect input $v_package = escapeshellarg($_POST['v_package']); - $v_template = escapeshellarg($_POST['v_template']); + $v_web_template = escapeshellarg($_POST['v_web_template']); + $v_proxy_template = escapeshellarg($_POST['v_proxy_template']); + $v_dns_template = escapeshellarg($_POST['v_dns_template']); $v_shell = escapeshellarg($_POST['v_shell']); $v_web_domains = escapeshellarg($_POST['v_web_domains']); $v_web_aliases = escapeshellarg($_POST['v_web_aliases']); @@ -80,7 +84,9 @@ if ($_SESSION['user'] == 'admin') { unset($output); // Create package - $pkg = "TEMPLATE=".$v_template."\n"; + $pkg = "WEB_TEMPLATE=".$v_web_template."\n"; + $pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n"; + $pkg .= "DNS_TEMPLATE=".$v_dns_template."\n"; $pkg .= "WEB_DOMAINS=".$v_web_domains."\n"; $pkg .= "WEB_ALIASES=".$v_web_aliases."\n"; $pkg .= "DNS_DOMAINS=".$v_dns_domains."\n"; @@ -129,7 +135,17 @@ if ($_SESSION['user'] == 'admin') { exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); check_error($return_var); - $templates = json_decode(implode('', $output), true); + $web_templates = json_decode(implode('', $output), true); + unset($output); + + exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); + check_error($return_var); + $proxy_templates = json_decode(implode('', $output), true); + unset($output); + + exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); + check_error($return_var); + $dns_templates = json_decode(implode('', $output), true); unset($output); exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); @@ -138,7 +154,9 @@ if ($_SESSION['user'] == 'admin') { unset($output); // Set default values - if (empty($v_template)) $v_template = 'default'; + if (empty($v_web_template)) $v_web_template = 'default'; + if (empty($v_proxy_template)) $v_proxy_template = 'default'; + if (empty($v_dns_template)) $v_dns_template = 'default'; if (empty($v_shell)) $v_shell = 'nologin'; if (empty($v_web_domains)) $v_web_domains = "'0'"; if (empty($v_web_aliases)) $v_web_aliases = "'0'"; diff --git a/web/add/web/index.php b/web/add/web/index.php index 19f2e04ce..4b533fe17 100644 --- a/web/add/web/index.php +++ b/web/add/web/index.php @@ -25,26 +25,21 @@ $v_ftp_email = $panel[$user]['CONTACT']; if ((!empty($_POST['v_ssl'])) || (!empty($_POST['v_elog']))) $v_adv = 'yes'; if ((!empty($_POST['v_ssl_crt'])) || (!empty($_POST['v_ssl_key']))) $v_adv = 'yes'; if ((!empty($_POST['v_ssl_ca'])) || ($_POST['v_stats'] != 'none')) $v_adv = 'yes'; - if (empty($_POST['v_nginx'])) $v_adv = 'yes'; + if (empty($_POST['v_proxy'])) $v_adv = 'yes'; if (!empty($_POST['v_ftp'])) $v_adv = 'yes'; - $v_nginx_ext = 'jpg, jpeg, gif, png, ico, svg, css, zip, tgz, gz, rar, bz2, exe, pdf, '; - $v_nginx_ext .= 'doc, xls, ppt, txt, odt, ods, odp, odf, tar, bmp, rtf, js, mp3, avi, '; - $v_nginx_ext .= 'mpeg, flv, html, htm'; - if ($_POST['v_nginx_ext'] != $v_nginx_ext) $v_adv = 'yes'; + $v_proxy_ext = 'jpg, jpeg, gif, png, ico, svg, css, zip, tgz, gz, rar, bz2, exe, pdf, '; + $v_proxy_ext .= 'doc, xls, ppt, txt, odt, ods, odp, odf, tar, bmp, rtf, js, mp3, avi, '; + $v_proxy_ext .= 'mpeg, flv, html, htm'; + if ($_POST['v_proxy_ext'] != $v_proxy_ext) $v_adv = 'yes'; // Protect input $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']); $v_domain = escapeshellarg($v_domain); $v_ip = escapeshellarg($_POST['v_ip']); - if ($_SESSION['user'] == 'admin') { - $v_template = escapeshellarg($_POST['v_template']); - } else { - $v_template = "''"; - } if (empty($_POST['v_dns'])) $v_dns = 'off'; if (empty($_POST['v_mail'])) $v_mail = 'off'; - if (empty($_POST['v_nginx'])) $v_nginx = 'off'; + if (empty($_POST['v_proxy'])) $v_proxy = 'off'; $v_aliases = $_POST['v_aliases']; $v_elog = $_POST['v_elog']; $v_ssl = $_POST['v_ssl']; @@ -55,11 +50,11 @@ $v_ftp_email = $panel[$user]['CONTACT']; $v_stats = escapeshellarg($_POST['v_stats']); $v_stats_user = $data[$v_domain]['STATS_USER']; $v_stats_password = $data[$v_domain]['STATS_PASSWORD']; - $v_nginx_ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']); - $v_nginx_ext = preg_replace("/,/", " ", $v_nginx_ext); - $v_nginx_ext = preg_replace('/\s+/', ' ',$v_nginx_ext); - $v_nginx_ext = trim($v_nginx_ext); - $v_nginx_ext = str_replace(' ', ", ", $v_nginx_ext); + $v_proxy_ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); + $v_proxy_ext = preg_replace("/,/", " ", $v_proxy_ext); + $v_proxy_ext = preg_replace('/\s+/', ' ',$v_proxy_ext); + $v_proxy_ext = trim($v_proxy_ext); + $v_proxy_ext = str_replace(' ', ", ", $v_proxy_ext); $v_ftp = $_POST['v_ftp']; $v_ftp_user = $_POST['v_ftp_user']; $v_ftp_password = $_POST['v_ftp_password']; @@ -100,7 +95,7 @@ $v_ftp_email = $panel[$user]['CONTACT']; if (empty($_SESSION['error_msg'])) { // Add WEB - exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." 'no'", $output, $return_var); + exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); if ($return_var != 0) { $error = implode('
', $output); if (empty($error)) $error = __('Error code:',$return_var); @@ -176,11 +171,11 @@ $v_ftp_email = $panel[$user]['CONTACT']; } - // Add Nginx - if (($_POST['v_nginx'] == 'on') && (empty($_SESSION['error_msg']))) { - $ext = str_replace(' ', '', $v_nginx_ext); + // Add proxy + if (($_POST['v_proxy'] == 'on') && (empty($_SESSION['error_msg']))) { + $ext = str_replace(' ', '', $v_proxy_ext); $ext = escapeshellarg($ext); - exec (VESTA_CMD."v-add-web-domain-nginx ".$user." ".$v_domain." 'default' ".$ext." 'no'", $output, $return_var); + exec (VESTA_CMD."v-add-web-domain-proxy ".$user." ".$v_domain." ".$ext." 'no'", $output, $return_var); if ($return_var != 0) { $error = implode('
', $output); if (empty($error)) $error = __('Error code:',$return_var); @@ -272,7 +267,6 @@ $v_ftp_email = $panel[$user]['CONTACT']; $from = __('MAIL_FROM',$hostname); $mailtext .= __('FTP_ACCOUNT_READY',$_POST['v_domain'],$user,$_POST['v_ftp_user'],$_POST['v_ftp_password']); send_email($to, $subject, $mailtext, $from); - //unset($v_ftp_email); } } unset($v_ftp); @@ -298,6 +292,18 @@ $v_ftp_email = $panel[$user]['CONTACT']; if (empty($error)) $error = __('Error code:',$return_var); $_SESSION['error_msg'] = $error; } + } + + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-restart-proxy", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = __('Error code:',$return_var); + $_SESSION['error_msg'] = $error; + } + } + + if (empty($_SESSION['error_msg'])) { unset($output); $_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]); unset($v_domain); @@ -314,14 +320,6 @@ $v_ftp_email = $panel[$user]['CONTACT']; $ips = json_decode(implode('', $output), true); unset($output); - exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var); - $template = $output[0] ; - unset($output); - - exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); - $templates = json_decode(implode('', $output), true); - unset($output); - exec (VESTA_CMD."v-list-web-stats json", $output, $return_var); $stats = json_decode(implode('', $output), true); unset($output); diff --git a/web/edit/package/index.php b/web/edit/package/index.php index 9903481f9..6b410d3ca 100644 --- a/web/edit/package/index.php +++ b/web/edit/package/index.php @@ -33,7 +33,9 @@ if ($_SESSION['user'] == 'admin') { unset($output); $v_package = $_GET['package']; - $v_template = $data[$v_package]['TEMPLATE']; + $v_web_template = $data[$v_package]['WEB_TEMPLATE']; + $v_proxy_template = $data[$v_package]['PROXY_TEMPLATE']; + $v_dns_template = $data[$v_package]['DNS_TEMPLATE']; $v_web_domains = $data[$v_package]['WEB_DOMAINS']; $v_web_aliases = $data[$v_package]['WEB_ALIASES']; $v_dns_domains = $data[$v_package]['DNS_DOMAINS']; @@ -59,7 +61,17 @@ if ($_SESSION['user'] == 'admin') { exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); check_error($return_var); - $templates = json_decode(implode('', $output), true); + $web_templates = json_decode(implode('', $output), true); + unset($output); + + exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); + check_error($return_var); + $proxy_templates = json_decode(implode('', $output), true); + unset($output); + + exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); + check_error($return_var); + $dns_templates = json_decode(implode('', $output), true); unset($output); exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); @@ -71,7 +83,9 @@ if ($_SESSION['user'] == 'admin') { if (!empty($_POST['save'])) { // Check input if (empty($_POST['v_package'])) $errors[] = __('package'); - if (empty($_POST['v_template'])) $errors[] = __('template'); + if (empty($_POST['v_web_template'])) $errors[] = __('web template'); + if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template'); + if (empty($_POST['v_dns_template'])) $errors[] = __('dns template'); if (empty($_POST['v_shell'])) $errrors[] = __('shell'); if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains'); if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases'); @@ -89,7 +103,9 @@ if ($_SESSION['user'] == 'admin') { // Protect input $v_package = escapeshellarg($_POST['v_package']); - $v_template = escapeshellarg($_POST['v_template']); + $v_web_template = escapeshellarg($_POST['v_web_template']); + $v_proxy_template = escapeshellarg($_POST['v_proxy_template']); + $v_dns_template = escapeshellarg($_POST['v_dns_template']); $v_shell = escapeshellarg($_POST['v_shell']); $v_web_domains = escapeshellarg($_POST['v_web_domains']); $v_web_aliases = escapeshellarg($_POST['v_web_aliases']); @@ -129,7 +145,9 @@ if ($_SESSION['user'] == 'admin') { unset($output); // Create package - $pkg = "TEMPLATE=".$v_template."\n"; + $pkg = "WEB_TEMPLATE=".$v_web_template."\n"; + $pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n"; + $pkg .= "DNS_TEMPLATE=".$v_dns_template."\n"; $pkg .= "WEB_DOMAINS=".$v_web_domains."\n"; $pkg .= "WEB_ALIASES=".$v_web_aliases."\n"; $pkg .= "DNS_DOMAINS=".$v_dns_domains."\n"; diff --git a/web/edit/user/index.php b/web/edit/user/index.php index 47d6eeaa8..9493e89c9 100644 --- a/web/edit/user/index.php +++ b/web/edit/user/index.php @@ -32,7 +32,6 @@ if ($_SESSION['user'] == 'admin') { $v_username = $_GET['user']; $v_password = "••••••••"; $v_email = $data[$v_username]['CONTACT']; - $v_template = $data[$v_username]['TEMPLATE']; $v_package = $data[$v_username]['PACKAGE']; $v_language = $data[$v_username]['LANGUAGE']; $v_fname = $data[$v_username]['FNAME']; @@ -61,10 +60,6 @@ if ($_SESSION['user'] == 'admin') { $languages = json_decode(implode('', $output), true); unset($output); - exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); - $templates = json_decode(implode('', $output), true); - unset($output); - exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); $shells = json_decode(implode('', $output), true); unset($output); @@ -113,18 +108,6 @@ if ($_SESSION['user'] == 'admin') { unset($output); } - // Change template - if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { - $v_template = escapeshellarg($_POST['v_template']); - exec (VESTA_CMD."v-change-user-template ".$v_username." ".$v_template, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = __('Error code:',$return_var); - $_SESSION['error_msg'] = $error; - } - unset($output); - } - // Change shell if (($v_shell != $_POST['v_shell']) && (empty($_SESSION['error_msg']))) { $v_shell = escapeshellarg($_POST['v_shell']); diff --git a/web/edit/web/index.php b/web/edit/web/index.php index 1615b2e36..7e7723bee 100644 --- a/web/edit/web/index.php +++ b/web/edit/web/index.php @@ -54,8 +54,9 @@ if ($return_var != 0) { $v_ssl_ca = $ssl_str[$v_domain]['CA']; } $v_ssl_home = $data[$v_domain]['SSL_HOME']; - $v_nginx = $data[$v_domain]['NGINX']; - $v_nginx_ext = str_replace(',', ', ', $data[$v_domain]['NGINX_EXT']); + $v_proxy = $data[$v_domain]['PROXY']; + $v_proxy_template = $data[$v_domain]['PROXY']; + $v_proxy_ext = str_replace(',', ', ', $data[$v_domain]['PROXY_EXT']); $v_stats = $data[$v_domain]['STATS']; $v_stats_user = $data[$v_domain]['STATS_USER']; if (!empty($v_stats_user)) $v_stats_password = "••••••••"; @@ -78,6 +79,10 @@ if ($return_var != 0) { $templates = json_decode(implode('', $output), true); unset($output); + exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); + $proxy_templates = json_decode(implode('', $output), true); + unset($output); + exec (VESTA_CMD."v-list-web-stats json", $output, $return_var); $stats = json_decode(implode('', $output), true); unset($output); @@ -200,56 +205,56 @@ if (!empty($_POST['save'])) { } } - // Nginx - if ((!empty($v_nginx)) && (empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-web-domain-nginx ".$v_username." ".$v_domain." 'no'", $output, $return_var); + // Proxy + if ((!empty($v_proxy)) && (empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-web-domain-proxy ".$v_username." ".$v_domain." 'no'", $output, $return_var); if ($return_var != 0) { $error = implode('
', $output); if (empty($error)) $error = __('Error code:',$return_var); $_SESSION['error_msg'] = $error; } unset($output); - unset($v_nginx); - $restart_web = 'yes'; + unset($v_proxy); + $restart_proxy = 'yes'; } - if ((!empty($v_nginx)) && (!empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { - $ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']); + if ((!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { + $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); $ext = preg_replace("/,/", " ", $ext); $ext = preg_replace('/\s+/', ' ',$ext); $ext = trim($ext); $ext = str_replace(' ', ", ", $ext); - if ( $v_nginx_ext != $ext ) { + if (( $v_proxy_template != $_POST['v_proxy_template']) || ($v_proxy_ext != $ext)) { $ext = str_replace(', ', ",", $ext); - exec (VESTA_CMD."v-change-web-domain-nginx-tpl ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var); + exec (VESTA_CMD."v-change-web-domain-proxy-tpl ".$v_username." ".$v_domain." ".escapeshellarg($_POST['v_proxy_template'])." ".escapeshellarg($ext)." 'no'", $output, $return_var); if ($return_var != 0) { $error = implode('
', $output); if (empty($error)) $error = __('Error code:',$return_var); $_SESSION['error_msg'] = $error; } - $v_nginx_ext = str_replace(',', ', ', $ext); + $v_proxy_template = $_POST['v_proxy_template']; + $v_proxy_ext = str_replace(',', ', ', $ext); unset($output); - $restart_web = 'yes'; + $restart_proxy = 'yes'; } } - if ((empty($v_nginx)) && (!empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { - $nginx_ext = "'jpg,jpeg,gif,png,ico,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,tar,wav,bmp,rtf,js,mp3,avi,mpeg,html,htm'"; - if (!empty($_POST['v_nginx_ext'])) { - $ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']); + if ((empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { + $v_proxy_template = $_POST['v_proxy_template']; + if (!empty($_POST['v_proxy_ext'])) { + $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); $ext = preg_replace("/,/", " ", $ext); $ext = preg_replace('/\s+/', ' ',$ext); $ext = trim($ext); $ext = str_replace(' ', ",", $ext); - $v_nginx_ext = str_replace(',', ', ', $ext); + $v_proxy_ext = str_replace(',', ', ', $ext); } - exec (VESTA_CMD."v-add-web-domain-nginx ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var); + exec (VESTA_CMD."v-add-web-domain-proxy ".$v_username." ".$v_domain." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." 'no'", $output, $return_var); if ($return_var != 0) { $error = implode('
', $output); if (empty($error)) $error = __('Error code:',$return_var); $_SESSION['error_msg'] = $error; } unset($output); - $v_nginx = 'default'; - $restart_web = 'yes'; + $restart_proxy = 'yes'; } // SSL diff --git a/web/inc/i18n/en.php b/web/inc/i18n/en.php index 437c7a525..f356af8e6 100644 --- a/web/inc/i18n/en.php +++ b/web/inc/i18n/en.php @@ -134,6 +134,9 @@ $LANG['en'] = array( 'Databases' => 'Databases', 'User Directories' => 'User Directories', 'Template' => 'Template', + 'Web Template' => 'Apache Template', + 'Proxy Template' => 'Nginx Template', + 'DNS Template' => 'DNS Template', 'Web Domains' => 'Web Domains', 'SSL Domains' => 'SSL Domains', 'Web Aliases' => 'Web Aliases', @@ -151,8 +154,8 @@ $LANG['en'] = array( 'template' => 'template', 'SSL Support' => 'SSL Support', 'SSL Home Directory' => 'SSL Home', - 'Nginx Support' => 'Nginx Support', - 'Nginx Extentions' => 'Nginx Extentions', + 'Proxy Support' => 'Nginx Support', + 'Proxy Extentions' => 'Nginx Extentions', 'Web Statistics' => 'Web Statistics', 'Additional FTP Account' => 'Additional FTP', 'SOA' => 'SOA', @@ -231,8 +234,6 @@ $LANG['en'] = array( 'Mail Support' => 'Mail Support', 'Advanced options' => 'Advanced options', 'Aliases' => 'Aliases', - 'Apache template' => 'Apache template', - 'Nginx template' => 'Nginx template', 'SSL Certificate' => 'SSL Certificate', 'SSL Key' => 'SSL Key', 'SSL Certificate Authority / Intermediate' => 'SSL Certificate Authority / Intermediate', diff --git a/web/inc/i18n/es.php b/web/inc/i18n/es.php index 23c947af0..b36425bab 100644 --- a/web/inc/i18n/es.php +++ b/web/inc/i18n/es.php @@ -133,6 +133,9 @@ $LANG['es'] = array( 'Databases' => 'Base de Datos', 'User Directories' => 'Directorios de Usuario', 'Template' => 'Plantilla', + 'Web Template' => 'Plantilla Apache', + 'Proxy Template' => 'Plantilla Nginx', + 'DNS Template' => 'Plantilla DNS', 'Web Domains' => 'Dominios Web', 'SSL Domains' => 'Dominios SSL', 'Web Aliases' => 'Alias Web', @@ -150,8 +153,8 @@ $LANG['es'] = array( 'template' => 'plantilla', 'SSL Support' => 'Soporte SSL', 'SSL Home Directory' => 'SSL Home', - 'Nginx Support' => 'Soporte Nginx', - 'Nginx Extentions' => 'Extensiones Nginx', + 'Proxy Support' => 'Soporte Nginx', + 'Proxy Extentions' => 'Extensiones Nginx', 'Web Statistics' => 'Estadísticas Web', 'Additional FTP Account' => 'Cuenta Adicional FTP', 'SOA' => 'SOA', @@ -230,8 +233,6 @@ $LANG['es'] = array( 'Mail Support' => 'Soporte para Correo', 'Advanced options' => 'Opciones Avanzadas', 'Aliases' => 'Aliases', - 'Apache template' => 'Plantilla Apache', - 'Nginx template' => 'Plantilla Nginx', 'SSL Certificate' => 'Certificado SSL', 'SSL Key' => 'Llave SSL', 'SSL Certificate Authority / Intermediate' => 'Certificado SSL Autoridad / Intermedio', diff --git a/web/inc/i18n/ro.php b/web/inc/i18n/ro.php index 22da695a1..b72ceab67 100644 --- a/web/inc/i18n/ro.php +++ b/web/inc/i18n/ro.php @@ -135,6 +135,9 @@ $LANG['ro'] = array( 'Databases' => 'Baze de date', 'User Directories' => 'Directoare utilizator', 'Template' => 'Șablon', + 'Web Template' => 'Șablonul Apache', + 'Proxy Template' => 'Șablonul Nginx', + 'DNS Template' => 'Șablonul DNS', 'Web Domains' => 'Web domenii', 'SSL Domains' => 'SSL domenii', 'Web Aliases' => 'Web aliasuri', @@ -152,8 +155,8 @@ $LANG['ro'] = array( 'template' => 'șablon', 'SSL Support' => 'Support SSL', 'SSL Home Directory' => 'Mapa SSL', - 'Nginx Support' => 'Support Nginx', - 'Nginx Extentions' => 'Extensii Nginx', + 'Proxy Support' => 'Support Nginx', + 'Proxy Extentions' => 'Extensii Nginx', 'Web Statistics' => 'Statistici web', 'Additional FTP Account' => 'Cont suplimentar FTP', 'SOA' => 'SOA', @@ -232,8 +235,6 @@ $LANG['ro'] = array( 'Mail Support' => 'Support E-mail', 'Advanced options' => 'Opțiuni avansate', 'Aliases' => 'Aliasuri', - 'Apache template' => 'Șablonul Apache', - 'Nginx template' => 'Șablonul Nginx', 'SSL Certificate' => 'Certificat SSL', 'SSL Key' => 'Cheia SSL', 'SSL Certificate Authority / Intermediate' => 'SSL Intermediar / Certificate Authority', diff --git a/web/inc/i18n/ru.php b/web/inc/i18n/ru.php index 97b782932..450232614 100644 --- a/web/inc/i18n/ru.php +++ b/web/inc/i18n/ru.php @@ -135,6 +135,9 @@ $LANG['ru'] = array( 'Databases' => 'Базы данных', 'User Directories' => 'Папки пользователя', 'Template' => 'Шаблон', + 'Web Template' => 'Шаблон Apache', + 'Proxy Template' => 'Шаблон Nginx', + 'DNS Template' => 'DNS Template', 'Web Domains' => 'Веб домены', 'SSL Domains' => 'SSL домены', 'Web Aliases' => 'Веб алиасы', @@ -152,8 +155,8 @@ $LANG['ru'] = array( 'template' => 'шаблон', 'SSL Support' => 'Поддержка SSL', 'SSL Home Directory' => 'Директория SSL', - 'Nginx Support' => 'Поддержка Nginx', - 'Nginx Extentions' => 'Обработка Nginx', + 'Proxy Support' => 'Поддержка Nginx', + 'Proxy Extentions' => 'Обработка Nginx', 'Web Statistics' => 'Статистика сайта', 'Additional FTP Account' => 'Дополнительный ftp', 'SOA' => 'SOA', @@ -232,8 +235,6 @@ $LANG['ru'] = array( 'Mail Support' => 'Поддержка почты', 'Advanced options' => 'Дополнительные опции', 'Aliases' => 'Алиасы', - 'Apache template' => 'Шаблон Apache', - 'Nginx template' => 'Шаблон для Nginx', 'SSL Certificate' => 'SSL сертификат', 'SSL Key' => 'Ключ SSL сертификата', 'SSL Certificate Authority / Intermediate' => 'Центр сертификации SSL / Intermediate', diff --git a/web/inc/i18n/ua.php b/web/inc/i18n/ua.php index d636dddfe..5e35a4608 100644 --- a/web/inc/i18n/ua.php +++ b/web/inc/i18n/ua.php @@ -135,6 +135,9 @@ $LANG['ua'] = array( 'Databases' => 'Бази даних', 'User Directories' => 'Теки Користувача', 'Template' => 'Шаблон', + 'Web Template' => 'Шаблон Apache', + 'Proxy Template' => 'Шаблон Nginx', + 'DNS Template' => 'Шаблон DNS', 'Web Domains' => 'Веб домени', 'SSL Domains' => 'SSL домени', 'Web Aliases' => 'Веб аліаси', @@ -152,8 +155,8 @@ $LANG['ua'] = array( 'template' => 'шаблон', 'SSL Support' => 'Підтримка SSL', 'SSL Home Directory' => 'Тека SSL', - 'Nginx Support' => 'Підтримка Nginx', - 'Nginx Extentions' => 'Опрацювання Nginx', + 'Proxy Support' => 'Підтримка Nginx', + 'Proxy Extentions' => 'Опрацювання Nginx', 'Web Statistics' => 'Статистика сайту', 'Additional FTP Account' => 'Додатковий ftp', 'SOA' => 'SOA', @@ -232,8 +235,6 @@ $LANG['ua'] = array( 'Mail Support' => 'Підтримка пошти', 'Advanced options' => 'Додаткові опції', 'Aliases' => 'Аліаси', - 'Apache template' => 'Шаблон Apache', - 'Nginx template' => 'Шаблон Nginx', 'SSL Certificate' => 'SSL сертификат', 'SSL Key' => 'Ключ SSL сертифікату', 'SSL Certificate Authority / Intermediate' => 'Центр сертифікації SSL / Intermediate', diff --git a/web/inc/main.php b/web/inc/main.php index 6d3a13006..b560453bd 100644 --- a/web/inc/main.php +++ b/web/inc/main.php @@ -150,17 +150,17 @@ function humanize_usage($usage) { if ( $usage > 1000 ) { $usage = $usage / 1000 ; $usage = number_format($usage, 2); - $usage = $usage." ".__('pb'); + $usage = $usage."".__('pb'); } else { $usage = number_format($usage, 2); - $usage = $usage." ".__('tb'); + $usage = $usage."".__('tb'); } } else { $usage = number_format($usage, 2); - $usage = $usage." ".__('gb'); + $usage = $usage."".__('gb'); } } else { - $usage = $usage." ".__('mb'); + $usage = $usage."".__('mb'); } return $usage; } diff --git a/web/templates/admin/add_db.html b/web/templates/admin/add_db.html index f0eceadde..fa62dd508 100644 --- a/web/templates/admin/add_db.html +++ b/web/templates/admin/add_db.html @@ -67,7 +67,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -115,7 +115,7 @@ - + diff --git a/web/templates/admin/add_dns.html b/web/templates/admin/add_dns.html index 0818b55a0..c20541260 100644 --- a/web/templates/admin/add_dns.html +++ b/web/templates/admin/add_dns.html @@ -81,29 +81,6 @@ - - - - - - + + + + + + + + + + + +
- -
- -
() diff --git a/web/templates/admin/add_package.html b/web/templates/admin/add_package.html index 185b5089c..d48937d7d 100644 --- a/web/templates/admin/add_package.html +++ b/web/templates/admin/add_package.html @@ -54,19 +54,65 @@
- +
- $value) { + foreach ($web_templates as $key => $value) { echo "\t\t\t\t\n"; + } + ?> + +
+ +
+ +
+ +
+
- @@ -154,48 +154,25 @@ - - - - - -
+
- +
- -
- + onclick="javascript:elementHideShow('proxytable');">
- onclick="javascript:elementHideShow('nginxtable');"> -
- +
- +
- +
diff --git a/web/templates/admin/edit_cron.html b/web/templates/admin/edit_cron.html index b46f46c21..4dd92988f 100644 --- a/web/templates/admin/edit_cron.html +++ b/web/templates/admin/edit_cron.html @@ -34,8 +34,8 @@ diff --git a/web/templates/admin/edit_db.html b/web/templates/admin/edit_db.html index 8bf1b98bb..d01bccdd5 100644 --- a/web/templates/admin/edit_db.html +++ b/web/templates/admin/edit_db.html @@ -54,8 +54,8 @@
-
- +
+
@@ -99,7 +99,7 @@ - @@ -109,7 +109,7 @@ - @@ -119,7 +119,7 @@ - diff --git a/web/templates/admin/edit_dns.html b/web/templates/admin/edit_dns.html index 89b256a7a..06fcdbbf7 100644 --- a/web/templates/admin/edit_dns.html +++ b/web/templates/admin/edit_dns.html @@ -33,8 +33,8 @@
-
- +
+
+
+
+
diff --git a/web/templates/admin/edit_dns_rec.html b/web/templates/admin/edit_dns_rec.html index 388ff5409..14bf72bcb 100644 --- a/web/templates/admin/edit_dns_rec.html +++ b/web/templates/admin/edit_dns_rec.html @@ -33,8 +33,8 @@
-
- +
+
diff --git a/web/templates/admin/edit_ip.html b/web/templates/admin/edit_ip.html index 191a2901c..ec06d538e 100644 --- a/web/templates/admin/edit_ip.html +++ b/web/templates/admin/edit_ip.html @@ -45,8 +45,8 @@
-
- +
+
diff --git a/web/templates/admin/edit_mail.html b/web/templates/admin/edit_mail.html index 3162a8c0a..e5f1f8c77 100644 --- a/web/templates/admin/edit_mail.html +++ b/web/templates/admin/edit_mail.html @@ -33,8 +33,8 @@
-
- +
+
diff --git a/web/templates/admin/edit_mail_acc.html b/web/templates/admin/edit_mail_acc.html index 315128e58..c603d1089 100644 --- a/web/templates/admin/edit_mail_acc.html +++ b/web/templates/admin/edit_mail_acc.html @@ -54,8 +54,8 @@
-
- +
+
diff --git a/web/templates/admin/edit_package.html b/web/templates/admin/edit_package.html index 0a741d361..ecee84cde 100644 --- a/web/templates/admin/edit_package.html +++ b/web/templates/admin/edit_package.html @@ -33,8 +33,8 @@
-
- +
+
@@ -55,24 +55,71 @@ + + + + + + + + + + + +
-
- +
+
- +
- $value) { + foreach ($web_templates as $key => $value) { echo "\t\t\t\t\n"; + } + ?> + +
+ +
+ +
+ +
+ @@ -155,27 +155,6 @@ - - - - - -
-
- +
+
- -
diff --git a/web/templates/admin/edit_web.html b/web/templates/admin/edit_web.html index ff7c90f3e..acfb5aff7 100644 --- a/web/templates/admin/edit_web.html +++ b/web/templates/admin/edit_web.html @@ -65,8 +65,8 @@ @@ -113,7 +113,7 @@ - @@ -124,7 +124,7 @@ @@ -145,25 +145,49 @@ - diff --git a/web/templates/admin/list_mail.html b/web/templates/admin/list_mail.html index 686b289d1..5ba93be0c 100644 --- a/web/templates/admin/list_mail.html +++ b/web/templates/admin/list_mail.html @@ -109,21 +109,16 @@ - - diff --git a/web/templates/admin/list_packages.html b/web/templates/admin/list_packages.html index 006d5539a..89d0cfbd8 100644 --- a/web/templates/admin/list_packages.html +++ b/web/templates/admin/list_packages.html @@ -69,34 +69,30 @@ - -
-
- +
+
+
- +
- +
- onclick="javascript:elementHideShow('nginxtable');"> + onclick="javascript:elementHideShow('proxytable');">
- +
- + + + + + +
- + +
- + +
+ +
+
diff --git a/web/templates/admin/list_backup.html b/web/templates/admin/list_backup.html index bdf59f76f..fde2f7b22 100644 --- a/web/templates/admin/list_backup.html +++ b/web/templates/admin/list_backup.html @@ -64,12 +64,12 @@ $cron = __('no'); $udir = __('no'); - if (!empty($data[$key]['WEB'])) $web = __('yes').' ¨'; - if (!empty($data[$key]['DNS'])) $dns = __('yes').' ¨'; - if (!empty($data[$key]['MAIL'])) $mail = __('yes').' ¨'; - if (!empty($data[$key]['DB'])) $db = __('yes').' ¨'; - if (!empty($data[$key]['CRON'])) $cron = __('yes').' ¨'; - if (!empty($data[$key]['UDIR'])) $udir = __('yes').' ¨'; + if (!empty($data[$key]['WEB'])) $web = __('yes'); + if (!empty($data[$key]['DNS'])) $dns = __('yes'); + if (!empty($data[$key]['MAIL'])) $mail = __('yes'); + if (!empty($data[$key]['DB'])) $db = __('yes'); + if (!empty($data[$key]['CRON'])) $cron = __('yes'); + if (!empty($data[$key]['UDIR'])) $udir = __('yes'); ?> @@ -114,18 +114,10 @@
- - - - - - -
- -
- : -
- : + : +
+
+
@@ -133,32 +125,20 @@
- - + + + + - - - - - - - - @@ -167,36 +147,13 @@ diff --git a/web/templates/admin/list_db.html b/web/templates/admin/list_db.html index 57a51b7eb..7b5092cbf 100644 --- a/web/templates/admin/list_db.html +++ b/web/templates/admin/list_db.html @@ -100,20 +100,15 @@ - diff --git a/web/templates/admin/list_dns.html b/web/templates/admin/list_dns.html index 78edb6518..7bf6742fe 100644 --- a/web/templates/admin/list_dns.html +++ b/web/templates/admin/list_dns.html @@ -103,34 +103,30 @@ - -
- : + + : + + +
+ : + - - -
- : - - - - -
- : - - - +
- - - - - - - - - - -
- : + + : - - - + +
- : - - - - -
- : - - - - -
- - - -
- [] -
: -
-
+
: +
+
+ + + + +
@@ -143,6 +138,14 @@
+ : + + +
- [] -
+ + + + + - - - -
:
:
:
- - + + - - + +
::
::
- - - -
- > -
+ : -
-
+
+
+
@@ -155,10 +150,10 @@
- : + : - +
diff --git a/web/templates/admin/list_mail_acc.html b/web/templates/admin/list_mail_acc.html index 09bd95ad1..4dae92d72 100644 --- a/web/templates/admin/list_mail_acc.html +++ b/web/templates/admin/list_mail_acc.html @@ -97,10 +97,10 @@
+ : -
-
+
+
- - + + - - + + - + + + + @@ -105,88 +101,51 @@ diff --git a/web/templates/admin/list_stats.html b/web/templates/admin/list_stats.html index 7e25e675d..1e3319f08 100644 --- a/web/templates/admin/list_stats.html +++ b/web/templates/admin/list_stats.html @@ -1,10 +1,15 @@
- : - - - :
- : - - - :
+ :
: -
-
+
+
: -
-
+
+
- - + + - - + + - - + + - - + + - - + +
- : - - - :
- : - - - :
- : - - - :
- : - - - :
- : - - - :
- - + + - - + + - - + + - - + + + + + - - + +
- : - - - :
- : - - - :
- : - - - :
- : - - - :
:
- : - - - :
@@ -62,23 +58,18 @@
- - - - @@ -87,12 +78,18 @@
- [] -
+ : % () -
-
+
+
: % () -
-
+
+
- + + + +
- :
- :
+ :
- :
- :
+
+ : +
+ : + + :
diff --git a/web/templates/admin/list_user.html b/web/templates/admin/list_user.html index 3bff8d7ad..1d1bf1dcf 100644 --- a/web/templates/admin/list_user.html +++ b/web/templates/admin/list_user.html @@ -138,35 +138,42 @@
+ - + -
[]
[]
: % () -
-
+
+
: % () -
-
+
+
+ - + + + +
- :
- :
+ :
- :
- :
+
+ : +
+ : + + + :
@@ -174,12 +181,8 @@
- - - - - + - - + - diff --git a/web/templates/user/list_mail.html b/web/templates/user/list_mail.html index 393d00559..3a743d327 100644 --- a/web/templates/user/list_mail.html +++ b/web/templates/user/list_mail.html @@ -96,21 +96,16 @@ - - diff --git a/web/templates/user/list_stats.html b/web/templates/user/list_stats.html index 26094f2ff..60fdb7b3e 100644 --- a/web/templates/user/list_stats.html +++ b/web/templates/user/list_stats.html @@ -25,16 +25,11 @@
:
+ diff --git a/web/templates/admin/list_web.html b/web/templates/admin/list_web.html index c9f2fefa7..7e827a994 100644 --- a/web/templates/admin/list_web.html +++ b/web/templates/admin/list_web.html @@ -59,19 +59,19 @@ if (!empty($data[$key]['FTP_USER'])) { $ftp_user=$data[$key]['FTP_USER']; } - $nginx_support='no'; - if (!empty($data[$key]['NGINX'])) { - $nginx_support='yes'; + $proxy_support='no'; + if (!empty($data[$key]['PROXY'])) { + $proxy_support='yes'; } - if (strlen($data[$key]['NGINX_EXT']) > 16 ) { - $nginx_ext_title = str_replace(',', ', ', $data[$key]['NGINX_EXT']); - $nginx_ext = substr($data[$key]['NGINX_EXT'], 0, 16); - $nginx_ext = trim($nginx_ext, ","); - $nginx_ext = str_replace(',', ', ', $nginx_ext); - $nginx_ext = $nginx_ext.", ..."; + if (strlen($data[$key]['PROXY_EXT']) > 16 ) { + $proxy_ext_title = str_replace(',', ', ', $data[$key]['PROXY_EXT']); + $proxy_ext = substr($data[$key]['PROXY_EXT'], 0, 16); + $proxy_ext = trim($proxy_ext, ","); + $proxy_ext = str_replace(',', ', ', $proxy_ext); + $proxy_ext = $proxy_ext.", ..."; } else { - $nginx_ext_title = ''; - $nginx_ext = str_replace(',', ', ', $data[$key]['NGINX_EXT']); + $proxy_ext_title = ''; + $proxy_ext = str_replace(',', ', ', $data[$key]['PROXY_EXT']); } ?> @@ -135,53 +135,60 @@ - - -
: /
- [] -
+ : -
-
+
+
: -
-
+
+
+ - - + + + + + + - + - - - - - - - - -
::
:
:
:
:>
-
- + +
:
+
+ + + + + + + + + + + + + + + diff --git a/web/templates/header.html b/web/templates/header.html index 3c4a1f27c..badc968cd 100644 --- a/web/templates/header.html +++ b/web/templates/header.html @@ -86,6 +86,11 @@ color: #174f82; } + .top-selected-link:active { + color: #fff; + background-color: #f79b44; + } + .top-user { padding: 0 2px 0 0; text-decoration: none; @@ -131,7 +136,7 @@ } .nav-lnk:active { - color: #ccc; + color: #f79b44; } .nav-block { @@ -165,6 +170,10 @@ border-bottom: 4px solid #f79b44; } + .nav-selected-block:active { + color: #f79b44; + } + .nav-header { padding: 14px 0 0 6px; margin: 0; @@ -556,10 +565,12 @@ } .counter-name { + white-space: nowrap; vertical-align:top; - line-height: 1.2em; + line-height: 1.3em; font-size: 10pt; color: #505050; + padding: 0 4px 0 0; } .cron-counter-name { @@ -902,8 +913,8 @@ top: 2px; } + - diff --git a/web/templates/user/add_web.html b/web/templates/user/add_web.html index 87e71b8e7..1fdcfe31e 100644 --- a/web/templates/user/add_web.html +++ b/web/templates/user/add_web.html @@ -143,7 +143,7 @@
:
:
:>
:
- @@ -154,25 +154,25 @@ - @@ -124,25 +124,25 @@ - diff --git a/web/templates/user/list_dns.html b/web/templates/user/list_dns.html index d9cc16ebd..8b6bfa0c4 100644 --- a/web/templates/user/list_dns.html +++ b/web/templates/user/list_dns.html @@ -89,34 +89,30 @@ - -
+
- +
- onclick="javascript:elementHideShow('nginxtable');"> + onclick="javascript:elementHideShow('proxytable');">
- +
- +
- +
diff --git a/web/templates/user/edit_web.html b/web/templates/user/edit_web.html index 249f2a92d..2ca8bb479 100644 --- a/web/templates/user/edit_web.html +++ b/web/templates/user/edit_web.html @@ -113,7 +113,7 @@
+
- +
- onclick="javascript:elementHideShow('nginxtable');"> + onclick="javascript:elementHideShow('proxytable');">
- +
- +
- +
diff --git a/web/templates/user/list_db.html b/web/templates/user/list_db.html index 1f3d1c93f..7b4596275 100644 --- a/web/templates/user/list_db.html +++ b/web/templates/user/list_db.html @@ -86,20 +86,15 @@
- - - -
- [] -
: -
-
+
: +
+
+ + + + +
@@ -129,6 +124,14 @@
+ : + + +
- [] -
+ + + + + - - - -
:
:
:
- - + + - - + +
::
::
- - - -
- > -
+ : -
-
+
+
+
@@ -142,10 +137,10 @@
- : + : - +
diff --git a/web/templates/user/list_mail_acc.html b/web/templates/user/list_mail_acc.html index 98a063afe..f97a501ef 100644 --- a/web/templates/user/list_mail_acc.html +++ b/web/templates/user/list_mail_acc.html @@ -85,10 +85,10 @@
+ : -
-
+
+
- +
- - - - -
- +
- -
@@ -45,23 +40,18 @@ - - - - @@ -70,12 +60,18 @@
- [] -
+ : % () -
-
+
+
: % () -
-
+
+
- + + + +
- :
- :
+ :
- :
- :
+
+ : +
+ : + + :
diff --git a/web/templates/user/list_user.html b/web/templates/user/list_user.html index 50f9790f5..dfffeca72 100644 --- a/web/templates/user/list_user.html +++ b/web/templates/user/list_user.html @@ -60,35 +60,42 @@
+ - + -
[]
[]
: % () -
-
+
+
: % () -
-
+
+
+ - + + + +
- :
- :
+ :
- :
- :
+
+ : +
+ : + + + :
@@ -96,12 +103,8 @@
- - - - - +
:
+ diff --git a/web/templates/user/list_web.html b/web/templates/user/list_web.html index c78a0fe98..6e857cd5b 100644 --- a/web/templates/user/list_web.html +++ b/web/templates/user/list_web.html @@ -34,9 +34,11 @@ if ($data[$key]['SUSPENDED'] == 'yes') { $status = 'suspended'; $spnd_action = 'unsuspend' ; + $spnd_confirmation = 'UNSUSPEND_DOMAIN_CONFIRMATION' ; } else { $status = 'active'; $spnd_action = 'suspend' ; + $spnd_confirmation = 'SUSPEND_DOMAIN_CONFIRMATION' ; } if (!empty($data[$key]['SSL_HOME'])) { if ($data[$key]['SSL_HOME'] == 'same') { @@ -55,22 +57,21 @@ if (!empty($data[$key]['FTP_USER'])) { $ftp_user=$data[$key]['FTP_USER']; } - $nginx_support='no'; - if (!empty($data[$key]['NGINX'])) { - $nginx_support='yes'; + $proxy_support='no'; + if (!empty($data[$key]['PROXY'])) { + $proxy_support='yes'; } - if (strlen($data[$key]['NGINX_EXT']) > 16 ) { - $nginx_ext_title = str_replace(',', ', ', $data[$key]['NGINX_EXT']); - $nginx_ext = substr($data[$key]['NGINX_EXT'], 0, 16); - $nginx_ext = trim($nginx_ext, ","); - $nginx_ext = str_replace(',', ', ', $nginx_ext); - $nginx_ext = $nginx_ext.", ..."; + if (strlen($data[$key]['PROXY_EXT']) > 16 ) { + $proxy_ext_title = str_replace(',', ', ', $data[$key]['PROXY_EXT']); + $proxy_ext = substr($data[$key]['PROXY_EXT'], 0, 16); + $proxy_ext = trim($proxy_ext, ","); + $proxy_ext = str_replace(',', ', ', $proxy_ext); + $proxy_ext = $proxy_ext.", ..."; } else { - $nginx_ext_title = ''; - $nginx_ext = str_replace(',', ', ', $data[$key]['NGINX_EXT']); + $proxy_ext_title = ''; + $proxy_ext = str_replace(',', ', ', $data[$key]['PROXY_EXT']); } - ?> - + ?> - - +
: /
@@ -83,7 +84,7 @@ - + - - -
- [] -
+ : -
-
+
+
: -
-
+
+
+ - - + + + + + + - + - - - - - - - - -
::
:
:
:
:>
-
- + +
:
+
+ + + + + + + + + + + + + + +
:
:
:>
: