changed config directory strucure

This commit is contained in:
Serghey Rodin 2012-02-19 00:27:24 +02:00
commit 69006da61a
15 changed files with 99 additions and 95 deletions

View file

@ -73,7 +73,7 @@ is_package_full 'web_alias'
# Parsing domain values # Parsing domain values
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
# Parsing domain aliases # Parsing domain aliases
if [ -z "$ALIAS" ]; then if [ -z "$ALIAS" ]; then
@ -91,7 +91,7 @@ add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi
@ -99,14 +99,14 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
del_web_config del_web_config
add_web_config add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi

View file

@ -60,7 +60,7 @@ is_web_domain_key_empty '$CGI'
# Parsing domain values # Parsing domain values
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
CGI='yes' CGI='yes'
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
@ -73,7 +73,7 @@ add_web_config
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi

View file

@ -58,7 +58,7 @@ is_web_domain_key_empty '$ELOG'
# Parsing domain values # Parsing domain values
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
ELOG='yes' ELOG='yes'
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
@ -71,7 +71,7 @@ add_web_config
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi
@ -79,14 +79,14 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
del_web_config del_web_config
add_web_config add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi

View file

@ -156,15 +156,12 @@ then
for domain in $web_list; do for domain in $web_list; do
echo -e "$(date "+%F %T") $domain" echo -e "$(date "+%F %T") $domain"
# Building directory tree
mkdir -p $tmpdir/web/$domain/conf mkdir -p $tmpdir/web/$domain/conf
mkdir -p $tmpdir/web/$domain/ssl
# Defining domain variables # Defining domain variables
domain_idn=$(idn -t --quiet -a "$domain") domain_idn=$(idn -t --quiet -a "$domain")
get_web_domain_values get_web_domain_values
# Packing data folders # Packing data folders
cd $V_HOME/$user/web/$domain cd $V_HOME/$user/web/$domain
tar -cf $tmpdir/web/$domain/$domain.tar \ tar -cf $tmpdir/web/$domain/$domain.tar \
@ -173,20 +170,20 @@ then
# Creating web.config # Creating web.config
cd $tmpdir/web/$domain/ cd $tmpdir/web/$domain/
conf="$V_USERS/$user/web.conf" conf="$V_USERS/$user/web.conf"
grep "DOMAIN='$domain'" $conf > conf/web.conf grep "DOMAIN='$domain'" $conf > conf/vesta.conf
# Apache config # Apache config
if [ "$WEB_SYSTEM" = 'apache' ]; then if [ "$WEB_SYSTEM" = 'apache' ]; then
# Parsing httpd.conf # Parsing httpd.conf
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
get_web_config_brds get_web_config_brds
sed -n "$top_line,$bottom_line p" $conf > conf/httpd.conf sed -n "$top_line,$bottom_line p" $conf > conf/httpd.conf
# SSL check # SSL check
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
get_web_config_brds get_web_config_brds
sed -n "$top_line,$bottom_line p" $conf > conf/shttpd.conf sed -n "$top_line,$bottom_line p" $conf > conf/shttpd.conf
fi fi
@ -195,30 +192,30 @@ then
# Nginx config # Nginx config
if [ ! -z "$NGINX" ] ; then if [ ! -z "$NGINX" ] ; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
get_web_config_brds get_web_config_brds
sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf
# SSL check # SSL check
if [ "$SSL" = 'yes' ] ; then if [ "$SSL" = 'yes' ] ; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
get_web_config_brds get_web_config_brds
sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf
fi fi
fi fi
# Suplemental configs # Suplemental configs
for sconfig in $(ls $V_HOME/$user/conf/|grep ".$domain.conf"); do for sconfig in $(ls $V_HOME/$user/conf/web/|grep ".$domain.conf"); do
cp $V_HOME/$user/conf/$sconfig conf/ cp $V_HOME/$user/conf/web/$sconfig conf/
done done
# SSL Certificates # SSL Certificates
if [ "$SSL" = 'yes' ] ; then if [ "$SSL" = 'yes' ] ; then
cp $V_HOME/$user/conf/ssl.$domain.* ssl/ cp $V_HOME/$user/conf/web/ssl.$domain.* conf/
fi fi
tar -rf $tmpdir/web/$domain/$domain.tar conf ssl tar -rf $tmpdir/web/$domain/$domain.tar conf
mv $tmpdir/web/$domain/$domain.tar $tmpdir/web/ mv $tmpdir/web/$domain/$domain.tar $tmpdir/web/
rm -rf $tmpdir/web/$domain rm -rf $tmpdir/web/$domain
@ -263,7 +260,7 @@ then
# Backingup dns recods # Backingup dns recods
cp $V_USERS/$user/dns/$domain $domain cp $V_USERS/$user/dns/$domain $domain
cp /etc/namedb/$domain.db $domain.db cp $V_USERS/$user/conf/dns/$domain.db $domain.db
done done
echo echo
fi fi

View file

@ -60,7 +60,7 @@ is_ip_avalable
# Define variable for replace # Define variable for replace
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
old=$IP old=$IP
new=$ip new=$ip
replace_web_config replace_web_config
@ -68,21 +68,21 @@ replace_web_config
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
replace_web_config replace_web_config
fi fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
replace_web_config replace_web_config
fi fi
# Checking nginx # Checking nginx
if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
replace_web_config replace_web_config
fi fi

View file

@ -63,13 +63,13 @@ get_web_domain_values
# Deleting domain # Deleting domain
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
old_tpl=$TPL old_tpl=$TPL
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
del_web_config del_web_config
# Deleting ssl vhost # Deleting ssl vhost
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
fi fi
@ -79,7 +79,7 @@ email="$user@$domain"
group="$user" group="$user"
docroot="$V_HOME/$user/web/$domain/public_html" docroot="$V_HOME/$user/web/$domain/public_html"
docroot_string="DocumentRoot $docroot" docroot_string="DocumentRoot $docroot"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
tpl_file="$V_WEBTPL/apache_$template.tpl" tpl_file="$V_WEBTPL/apache_$template.tpl"
@ -147,18 +147,18 @@ fi
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
# Defining SSL vars # Defining SSL vars
ssl_crt="$V_HOME/$user/conf/ssl.$domain.crt" ssl_crt="$V_HOME/$user/conf/web/ssl.$domain.crt"
ssl_key="$V_HOME/$user/conf/ssl.$domain.key" ssl_key="$V_HOME/$user/conf/web/ssl.$domain.key"
ssl_pem="$V_HOME/$user/conf/ssl.$domain.pem" ssl_pem="$V_HOME/$user/conf/web/ssl.$domain.pem"
ssl_ca="$V_HOME/$user/conf/ssl.$domain.ca" ssl_ca="$V_HOME/$user/conf/web/ssl.$domain.ca"
if [ ! -e "$V_USERS/$user/ssl/$domain.ca" ]; then if [ ! -e "$V_USERS/$user/web/ssl/$domain.ca" ]; then
ssl_ca_str='#' ssl_ca_str='#'
fi fi
case $SSL_HOME in case $SSL_HOME in
single) docroot="$V_HOME/$user/web/$domain/public_shtml" ;; single) docroot="$V_HOME/$user/web/$domain/public_shtml" ;;
same) docroot="$V_HOME/$user/web/$domain/public_html" ;; same) docroot="$V_HOME/$user/web/$domain/public_html" ;;
esac esac
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
tpl_file="$V_WEBTPL/apache_$template.stpl" tpl_file="$V_WEBTPL/apache_$template.stpl"
# Adding domain to the httpd.conf # Adding domain to the httpd.conf

View file

@ -58,7 +58,7 @@ is_domain_suspended 'web'
# Get template name # Get template name
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
# Deleting domain # Deleting domain
del_web_config del_web_config
@ -66,50 +66,41 @@ del_web_config
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
# Deleting certificates # Deleting certificates
rm -f $V_HOME/$user/conf/ssl.$domain.* rm -f $V_HOME/$user/conf/web/ssl.$domain.*
rm -f $V_USERS/$user/ssl/$domain.* rm -f $V_USERS/$user/ssl/$domain.*
fi fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
del_web_config del_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
fi fi
fi fi
# Checking stats # Checking stats
if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
# Parsing pipe line sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
line=$(grep -n "$STATS.$domain.conf" $V_QUEUE/stats.pipe | \ rm -f $V_HOME/$user/conf/web/$STATS.$domain.conf
cut -f 1 -d : | head -n 1 )
# Deleting pipe command
if [ ! -z "$line" ]; then
sed -i "$line d" $V_QUEUE/stats.pipe
fi
# Deleteing config
rm -f $V_HOME/$user/conf/$STATS.$domain.conf
fi fi
# Deleting directory # Deleting directory
rm -rf $V_HOME/$user/web/$domain rm -rf $V_HOME/$user/web/$domain
# Deleting logs # Deleting logs
rm -rf /var/log/httpd/domains/$domain.log* rm -f /var/log/httpd/domains/$domain.log*
rm -rf /var/log/httpd/domains/$domain.bytes rm -f /var/log/httpd/domains/$domain.bytes
rm -rf /var/log/httpd/domains/$domain.error* rm -f /var/log/httpd/domains/$domain.error*
#----------------------------------------------------------# #----------------------------------------------------------#
@ -122,14 +113,14 @@ del_web_domain
# Checking last ssl domain # Checking last ssl domain
ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf | wc -l) ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf | wc -l)
if [ "$ssl_dom" -eq '0' ]; then if [ "$ssl_dom" -eq '0' ]; then
sed -i "s/ Include /#Include /" $V_HOME/$user/conf/httpd.conf sed -i "s/ Include /#Include /" $V_HOME/$user/conf/web/httpd.conf
fi fi
# Checking last domain # Checking last domain
domains=$(wc -l $V_USERS/$user/web.conf|cut -f 1 -d ' ') domains=$(wc -l $V_USERS/$user/web.conf|cut -f 1 -d ' ')
if [ "$domains" -eq '0' ]; then if [ "$domains" -eq '0' ]; then
conf='/etc/httpd/conf.d/vesta.conf' conf='/etc/httpd/conf.d/vesta.conf'
line=$(grep -n "$V_HOME/$user/conf/httpd.conf" $conf | cut -f 1 -d : ) line=$(grep -n "$V_HOME/$user/conf/web/httpd.conf" $conf | cut -f 1 -d : )
if [ ! -z "$line" ]; then if [ ! -z "$line" ]; then
sed -i "$line d" $conf sed -i "$line d" $conf
fi fi
@ -140,19 +131,19 @@ conf='/etc/nginx/conf.d/vesta_users.conf'
last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf) last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'") last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
if [ -z "$last_snginx" ]; then if [ -z "$last_snginx" ]; then
sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : ) sline=$(grep -n "$V_HOME/$user/conf/web/snginx.conf" $conf |cut -f 1 -d :)
if [ ! -z "$sline" ]; then if [ ! -z "$sline" ]; then
sed -i "$sline d" $conf sed -i "$sline d" $conf
fi fi
rm -f $V_HOME/$user/conf/snginx.conf rm -f $V_HOME/$user/conf/web/snginx.conf
fi fi
if [ -z "$last_nginx" ]; then if [ -z "$last_nginx" ]; then
line=$(grep -n "$V_HOME/$user/conf/nginx.conf" $conf | cut -f 1 -d : ) line=$(grep -n "$V_HOME/$user/conf/web/nginx.conf" $conf | cut -f 1 -d : )
if [ ! -z "$line" ]; then if [ ! -z "$line" ]; then
sed -i "$line d" $conf sed -i "$line d" $conf
fi fi
rm -f $V_HOME/$user/conf/nginx.conf rm -f $V_HOME/$user/conf/web/nginx.conf
fi fi
# Decreasing ip value # Decreasing ip value

View file

@ -69,7 +69,7 @@ ALIAS=$(echo "$ALIAS" |\
sed -e "/^$/d"|\ sed -e "/^$/d"|\
sed -e ':a;N;$!ba;s/\n/,/g') sed -e ':a;N;$!ba;s/\n/,/g')
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
upd_web_domain_values upd_web_domain_values
@ -80,7 +80,7 @@ add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi
@ -88,14 +88,14 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
del_web_config del_web_config
add_web_config add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi

View file

@ -59,7 +59,7 @@ is_web_domain_value_exist '$CGI'
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
CGI='no' CGI='no'
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
@ -72,7 +72,7 @@ add_web_config
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi

View file

@ -59,7 +59,7 @@ is_web_domain_value_exist '$ELOG'
# Parsing domain values # Parsing domain values
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
ELOG='no' ELOG='no'
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
@ -72,7 +72,7 @@ add_web_config
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi
@ -80,14 +80,14 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
del_web_config del_web_config
add_web_config add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi

View file

@ -81,13 +81,13 @@ conf='/etc/nginx/conf.d/vesta_users.conf'
last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf) last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'") last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
if [ -z "$last_snginx" ]; then if [ -z "$last_snginx" ]; then
sed -i "/$user\/conf\/snginx.conf/d" $conf sed -i "/$user\/conf\/web\/snginx.conf/d" $conf
rm -f $V_HOME/$user/conf/snginx.conf rm -f $V_HOME/$user/conf/web/snginx.conf
fi fi
if [ -z "$last_nginx" ]; then if [ -z "$last_nginx" ]; then
sed -i "/$user\/conf\/nginx.conf/d" $conf sed -i "/$user\/conf\/web\/nginx.conf/d" $conf
rm -f $V_HOME/$user/conf/nginx.conf rm -f $V_HOME/$user/conf/web/nginx.conf
fi fi
# Adding task to the vesta pipe # Adding task to the vesta pipe

View file

@ -56,7 +56,7 @@ is_web_domain_value_exist '$SSL'
# Parsing domain values # Parsing domain values
get_web_domain_values get_web_domain_values
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
# Deleting domain # Deleting domain
@ -65,7 +65,7 @@ del_web_config
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
fi fi

View file

@ -15,21 +15,37 @@ source $V_CONF/vesta.conf
# Restart functions # Restart functions
apache() { apache() {
/etc/init.d/httpd 'graceful' >/dev/null 2>&1 /etc/init.d/httpd status >/dev/null 2>&1
if [ $? -eq 0 ]; then
/etc/init.d/httpd graceful >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
#$V_FUNC/report_issue 'web' 'apache'
echo "$E_RESTART $1" echo "$E_RESTART $1"
exit $E_RESTART exit $E_RESTART
fi fi
else
/etc/init.d/httpd start >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
fi
} }
nginx() { nginx() {
/etc/init.d/nginx 'reload' >/dev/null 2>&1 /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 if [ $? -ne 0 ]; then
#$V_FUNC/report_issue 'web' 'nginx'
echo "$E_RESTART $1" echo "$E_RESTART $1"
exit $E_RESTART exit $E_RESTART
fi fi
else
/etc/init.d/nginx start >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
fi
} }

View file

@ -56,7 +56,7 @@ is_domain_suspended 'web'
# Parsing domain values # Parsing domain values
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
SUSPENDED='yes' SUSPENDED='yes'
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
@ -69,7 +69,7 @@ add_web_config
# Check ssl # Check ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi
@ -77,14 +77,14 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
del_web_config del_web_config
add_web_config add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
proxy_string="rewrite ^(.*)\$ http://$url;" proxy_string="rewrite ^(.*)\$ http://$url;"
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi

View file

@ -51,7 +51,7 @@ is_domain_unsuspended 'web'
# Parsing domain values # Parsing domain values
get_web_domain_values get_web_domain_values
tpl_file="$V_WEBTPL/apache_$TPL.tpl" tpl_file="$V_WEBTPL/apache_$TPL.tpl"
conf="$V_HOME/$user/conf/httpd.conf" conf="$V_HOME/$user/conf/web/httpd.conf"
SUSPENDED='no' SUSPENDED='no'
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
@ -64,7 +64,7 @@ add_web_config
# Check ssl # Check ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl" tpl_file="$V_WEBTPL/apache_$TPL.stpl"
conf="$V_HOME/$user/conf/shttpd.conf" conf="$V_HOME/$user/conf/web/shttpd.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi
@ -72,14 +72,14 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$V_HOME/$user/conf/nginx.conf" conf="$V_HOME/$user/conf/web/nginx.conf"
del_web_config del_web_config
add_web_config add_web_config
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$V_HOME/$user/conf/snginx.conf" conf="$V_HOME/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config
fi fi