improoved suspend function

This commit is contained in:
Serghey Rodin 2012-06-29 13:09:32 +03:00
commit e177cefef9
34 changed files with 75 additions and 172 deletions

View file

@ -72,7 +72,6 @@ fi
group="$user"
email="$user@$domain"
docroot="$HOMEDIR/$user/web/$domain/public_html"
docroot_string="DocumentRoot $docroot"
conf="$HOMEDIR/$user/conf/web/httpd.conf"
tpl_file="$WEBTPL/apache_$template.tpl"

View file

@ -73,14 +73,13 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
add_web_config
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
add_web_config

View file

@ -66,14 +66,13 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
add_web_config
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
add_web_config

View file

@ -49,7 +49,7 @@ is_nginx_template_valid
get_domain_values 'web'
NGINX="$template"
NGINX_EXT="$extentions"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
# Preparing domain values for the template substitution
@ -69,8 +69,7 @@ fi
# Checking ssl
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
add_web_config

View file

@ -84,7 +84,7 @@ fi
# Running template trigger
if [ -x $WEBTPL/apache_$template.sh ]; then
$WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot
$WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $sdocroot
fi
# Checking main vesta httpd config
@ -98,7 +98,7 @@ fi
if [ ! -z "$NGINX" ]; then
# Adding domain to the snginx.conf
conf="$HOMEDIR/$user/conf/web/snginx.conf"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
add_web_config
chown root:nginx $conf

View file

@ -163,14 +163,14 @@ then
# Nginx config
if [ ! -z "$NGINX" ] ; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
get_web_config_brds
sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf
# SSL check
if [ "$SSL" = 'yes' ] ; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
get_web_config_brds
sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf

View file

@ -60,14 +60,14 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
replace_web_config
fi
# Checking nginx
if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
replace_web_config
fi

View file

@ -48,7 +48,7 @@ is_nginx_template_valid
# Parsing domain values
get_domain_values 'web'
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
# Delete old vhost
@ -56,7 +56,7 @@ del_web_config
# Checking ssl
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
fi
@ -64,7 +64,7 @@ fi
# Add new vhost
NGINX="$template"
NGINX_EXT="$extentions"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
upd_web_domain_values
add_web_config
@ -73,8 +73,7 @@ chmod 640 $conf
# Checking ssl
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
add_web_config
chown root:nginx $conf

View file

@ -56,7 +56,7 @@ replace_web_config
# Checking nginx config
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web//snginx.conf"
replace_web_config
fi

View file

@ -58,55 +58,9 @@ if [ "$SSL" = 'yes' ]; then
fi
# Defining variables for new vhost config
ip=$IP
email="$user@$domain"
group="$user"
docroot="$HOMEDIR/$user/web/$domain/public_html"
docroot_string="DocumentRoot $docroot"
conf="$HOMEDIR/$user/conf/web/httpd.conf"
upd_web_domain_values
tpl_file="$WEBTPL/apache_$template.tpl"
# Parsing domain aliases
i=1
j=1
OLD_IFS="$IFS"
IFS=','
for dom_alias in $ALIAS; do
dom_alias=$(idn -t --quiet -a $dom_alias)
# Spliting ServerAlias lines
check_8k="$server_alias $dom_alias"
if [ "${#check_8k}" -ge '8100' ]; then
if [ "$j" -eq 1 ]; then
alias_string="ServerAlias $server_alias"
else
alias_string="$alias_string\n ServerAlias $server_alias"
fi
(( ++j))
server_alias=''
fi
if [ "$i" -eq 1 ]; then
aliases_idn="$dom_alias"
server_alias="$dom_alias"
alias_string="ServerAlias $server_alias"
else
aliases_idn="$aliases_idn,$dom_alias"
server_alias="$server_alias $dom_alias"
fi
(( ++i))
done
if [ -z "$alias_string" ]; then
alias_string="ServerAlias $server_alias"
else
if [ ! -z "$server_alias" ]; then
alias_string="$alias_string\n ServerAlias $server_alias"
fi
fi
IFS=$OLD_IFS
# Parsing new template
template_data=$(cat $WEBTPL/apache_$template.descr | grep -v '#')
for keys in $template_data; do
@ -130,28 +84,15 @@ fi
# Checking ssl
if [ "$SSL" = 'yes' ]; then
# Defining SSL vars
ssl_crt="$HOMEDIR/$user/conf/web/ssl.$domain.crt"
ssl_key="$HOMEDIR/$user/conf/web/ssl.$domain.key"
ssl_pem="$HOMEDIR/$user/conf/web/ssl.$domain.pem"
ssl_ca="$HOMEDIR/$user/conf/web/ssl.$domain.ca"
if [ ! -e "$USER_DATA/web/ssl/$domain.ca" ]; then
ssl_ca_str='#'
fi
case $SSL_HOME in
single) docroot="$HOMEDIR/$user/web/$domain/public_shtml" ;;
same) docroot="$HOMEDIR/$user/web/$domain/public_html" ;;
esac
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
tpl_file="$WEBTPL/apache_$template.stpl"
# Adding domain to the httpd.conf
add_web_config
# Running template trigger
if [ -x $WEBTPL/apache_$template.sh ]; then
$WEBTPL/apache_$template.sh \
"$user" "$domain" "$ip" "$HOMEDIR" "$docroot"
"$user" "$domain" "$ip" "$HOMEDIR" "$sdocroot"
fi
fi

View file

@ -70,13 +70,12 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
fi

View file

@ -72,14 +72,13 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
add_web_config
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
add_web_config

View file

@ -64,14 +64,13 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
add_web_config
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
add_web_config

View file

@ -41,13 +41,13 @@ is_object_value_exist 'web' 'DOMAIN' "$domain" '$NGINX'
# Defining domain parameters
get_domain_values 'web'
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
# Checking ssl
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
fi

View file

@ -49,7 +49,7 @@ del_web_config
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
fi

View file

@ -21,8 +21,8 @@ json_list_wtpl() {
i='1' # iterator
echo '{'
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
if [ -e "$WEBTPL/ngingx_vhost_$template.descr" ]; then
descr=$(cat $WEBTPL/ngingx_vhost_$template.descr | grep '#'|\
if [ -e "$WEBTPL/ngingx_$template.descr" ]; then
descr=$(cat $WEBTPL/ngingx_$template.descr | grep '#'|\
sed -e ':a;N;$!ba;s/\n/ /g')
if [ $i -ne 1 ]; then
echo -e "\t},"
@ -42,8 +42,8 @@ json_list_wtpl() {
# Shell function
shell_list_wtpl() {
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
if [ -e "$WEBTPL/ngingx_vhost_$template.descr" ]; then
tpl_descr=$(cat $WEBTPL/ngingx_vhost_$template.descr |grep '#')
if [ -e "$WEBTPL/ngingx_$template.descr" ]; then
tpl_descr=$(cat $WEBTPL/ngingx_$template.descr |grep '#')
if [ -z "$nohead" ]; then
echo "----------"
fi

View file

@ -18,14 +18,13 @@ source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/func/ip.sh
url=${2-$SUSPEND_URL}
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'user [suspend_url]'
validate_format 'user' 'url'
check_args '1' "$#" 'user'
validate_format 'user'
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
@ -177,7 +176,7 @@ for domain in $(shell_list) ; do
# Running template trigger
if [ -x $WEBTPL/apache_$TPL.sh ]; then
$WEBTPL/apache_$TPL.sh $user $domain $ip $HOMEDIR $docroot
$WEBTPL/apache_$TPL.sh $user $domain $ip $HOMEDIR $sdocroot
fi
user_ssl=$((user_ssl + 1))
@ -186,20 +185,14 @@ for domain in $(shell_list) ; do
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/tmp_nginx.conf"
add_web_config
chown root:nginx $conf
chmod 640 $conf
if [ "$SSL" = 'yes' ]; then
if [ "$SUSPENDED" = 'yes' ]; then
proxy_string="rewrite ^(.*)\$ http://$url;"
else
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
fi
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/tmp_snginx.conf"
add_web_config
chown root:nginx $conf

View file

@ -15,22 +15,21 @@
user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
restart=$3
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
url="${3-$SUSPEND_URL}"
restart=$4
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'user domain [suspend_url]'
validate_format 'user' 'domain' 'url'
check_args '2' "$#" 'user domain [restart]'
validate_format 'user' 'domain'
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
@ -64,14 +63,13 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
add_web_config
if [ "$SSL" = 'yes' ]; then
proxy_string="rewrite ^(.*)\$ http://$url;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
add_web_config

View file

@ -17,9 +17,6 @@ source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
# Defining url
url="${2-$SUSPEND_URL}"
#----------------------------------------------------------#
# Verifications #

View file

@ -25,7 +25,7 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'user domain'
check_args '2' "$#" 'user domain [restart]'
validate_format 'user' 'domain'
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
@ -60,14 +60,13 @@ fi
# Checking nginx
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
add_web_config
if [ "$SSL" = 'yes' ]; then
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
add_web_config

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %sdocroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/
@ -11,7 +11,7 @@
CustomLog /var/log/httpd/domains/%domain%.bytes bytes
CustomLog /var/log/httpd/domains/%domain%.log combined
%elog%ErrorLog /var/log/httpd/domains/%domain%.error.log
<Directory %docroot%>
<Directory %sdocroot%>
AllowOverride AuthConfig FileInfo Indexes Limit
SSLRequireSSL
Options +Includes -Indexes %cgi_option%

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %docroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %sdocroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/
@ -11,7 +11,7 @@
CustomLog /var/log/httpd/domains/%domain%.bytes bytes
CustomLog /var/log/httpd/domains/%domain%.log combined
%elog%ErrorLog /var/log/httpd/domains/%domain%.error.log
<Directory %docroot%>
<Directory %sdocroot%>
AllowOverride AuthConfig FileInfo Indexes Limit
SSLRequireSSL
Options +Includes -Indexes %cgi_option%

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %docroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %sdocroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/
@ -11,7 +11,7 @@
CustomLog /var/log/httpd/domains/%domain%.bytes bytes
CustomLog /var/log/httpd/domains/%domain%.log combined
%elog%ErrorLog /var/log/httpd/domains/%domain%.error.log
<Directory %docroot%>
<Directory %sdocroot%>
AllowOverride AuthConfig FileInfo Indexes Limit
SSLRequireSSL
Options +Includes -Indexes %cgi_option%

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %docroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %sdocroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/
@ -11,7 +11,7 @@
CustomLog /var/log/httpd/domains/%domain%.bytes bytes
CustomLog /var/log/httpd/domains/%domain%.log combined
%elog%ErrorLog /var/log/httpd/domains/%domain%.error.log
<Directory %docroot%>
<Directory %sdocroot%>
AllowOverride All
SSLRequireSSL
Options +Includes -Indexes %cgi_option%

View file

@ -3,7 +3,7 @@
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
%docroot_string%
DocumentRoot %docroot%
%cgi%ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/

View file

@ -3,7 +3,7 @@ server {
server_name _;
#access_log /var/log/nginx/%ip%.log main;
location / {
proxy_pass http://%ip%:%web_port%;
proxy_pass http://%ip%:%web_port%;
}
}

View file

@ -7,9 +7,9 @@ server {
%elog%error_log /var/log/httpd/domains/%domain%.error.log error;
location / {
%proxy_string%
proxy_pass https://%ip%:%web_ssl_port%;
location ~* ^.+\.(%nginx_extentions%)$ {
root %docroot%;
root %sdocroot%;
access_log /var/log/httpd/domains/%domain%.log combined;
access_log /var/log/httpd/domains/%domain%.bytes bytes;
expires max;

View file

@ -4,7 +4,7 @@ server {
%elog%error_log /var/log/httpd/domains/%domain%.error.log error;
location / {
%proxy_string%
proxy_pass http://%ip%:%web_port%;
location ~* ^.+\.(%nginx_extentions%)$ {
root %docroot%;
access_log /var/log/httpd/domains/%domain%.log combined;

View file

@ -13,9 +13,9 @@ is_apache_template_valid() {
# Nginx template check
is_nginx_template_valid() {
t="$WEBTPL/ngingx_vhost_$template.tpl"
d="$WEBTPL/ngingx_vhost_$template.descr"
s="$WEBTPL/ngingx_vhost_$template.stpl"
t="$WEBTPL/ngingx_$template.tpl"
d="$WEBTPL/ngingx_$template.descr"
s="$WEBTPL/ngingx_$template.stpl"
if [ ! -e $t ] || [ ! -e $d ] || [ ! -e $s ]; then
echo "Error: nginx $template not found"
log_event "$E_NOTEXIST" "$EVENT"
@ -142,7 +142,6 @@ add_web_config() {
sed -e "s/%ip%/$ip/g" \
-e "s/%web_port%/$WEB_PORT/g" \
-e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \
-e "s/%proxy_string%/${proxy_string////\/}/g" \
-e "s/%proxy_port%/$PROXY_PORT/g" \
-e "s/%proxy_ssl_port%/$PROXY_SSL_PORT/g" \
-e "s/%domain_idn%/$domain_idn/g" \
@ -151,7 +150,7 @@ add_web_config() {
-e "s/%group%/$group/g" \
-e "s/%home%/${HOMEDIR////\/}/g" \
-e "s/%docroot%/${docroot////\/}/g" \
-e "s/%docroot_string%/${docroot_string////\/}/g" \
-e "s/%sdocroot%/${sdocroot////\/}/g" \
-e "s/%email%/$email/g" \
-e "s/%alias_string%/$alias_string/g" \
-e "s/%alias_idn%/${aliases_idn//,/ }/g" \
@ -305,7 +304,7 @@ namehost_ip_support() {
sed -i "$conf_ins i Listen $ip:$WEB_PORT" $conf
if [ "$PROXY_SYSTEM" = 'nginx' ]; then
cat $WEBTPL/ngingx_ip.tpl | sed -e "s/%ip%/$ip/g" \
cat $WEBTPL/ngingx.ip.tpl | sed -e "s/%ip%/$ip/g" \
-e "s/%web_port%/$WEB_PORT/g" \
-e "s/%proxy_port%/$PROXY_PORT/g" >>$nconf
@ -323,8 +322,8 @@ namehost_ip_disable() {
sed -i "/Listen $ip:/d" $conf
if [ "$PROXY_SYSTEM" = 'nginx' ]; then
tpl_ln=$(wc -l $WEBTPL/ngingx_ip.tpl | cut -f 1 -d ' ')
ip_line=$(grep -n "%ip%" $WEBTPL/ngingx_ip.tpl |head -n1 |\
tpl_ln=$(wc -l $WEBTPL/ngingx.ip.tpl | cut -f 1 -d ' ')
ip_line=$(grep -n "%ip%" $WEBTPL/ngingx.ip.tpl |head -n1 |\
cut -f 1 -d :)
conf_line=$(grep -n -w $ip $nconf|head -n1|cut -f 1 -d :)
if [ -z "$tpl_ln" ] || [ -z "$ip_line" ] || [ -z "$conf_line" ]
@ -357,8 +356,9 @@ upd_web_domain_values() {
group="$user"
email="$user@$domain"
docroot="$HOMEDIR/$user/web/$domain/public_html"
docroot_string="DocumentRoot $docroot"
proxy_string="proxy_pass http://$ip:$WEB_PORT;"
if [ "$SSL_HOME" = 'single' ]; then
sdocroot="$HOMEDIR/$user/web/$domain/public_shtml" ;
fi
i=1
j=1
@ -410,11 +410,6 @@ upd_web_domain_values() {
cgi_option='+ExecCGI'
fi
if [ "$SUSPENDED" = 'yes' ]; then
docroot_string="Redirect / http://$url"
proxy_string="rewrite ^(.*)\$ http://$url;"
fi
ssl_crt="$HOMEDIR/$user/conf/web/ssl.$domain.crt"
ssl_key="$HOMEDIR/$user/conf/web/ssl.$domain.key"
ssl_pem="$HOMEDIR/$user/conf/web/ssl.$domain.pem"
@ -423,9 +418,9 @@ upd_web_domain_values() {
ssl_ca_str='#'
fi
case $SSL_HOME in
single) docroot="$HOMEDIR/$user/web/$domain/public_shtml" ;;
same) docroot="$HOMEDIR/$user/web/$domain/public_html" ;;
esac
if [ "$SUSPENDED" = 'yes' ]; then
docroot="$VESTA/data/templates/web/suspend"
sdocroot="$VESTA/data/templates/web/suspend"
fi
}

View file

@ -457,17 +457,6 @@ sync_cron_jobs() {
### Format Validators ###
# URL
validate_format_url() {
check_http=$(echo "$1" | grep "^http://" )
needed_chars=$(echo "$1" | cut -f 2 -d \.)
if [ -z "$check_http" ] || [ -z "$needed_chars" ]; then
echo "Error: url $1 is not valid"
log_event "$E_INVALID" "$EVENT"
exit $E_INVALID
fi
}
# Shell
validate_format_shell() {
if [ -z "$(grep -w $1 /etc/shells)" ]; then
@ -753,7 +742,6 @@ validate_format(){
stats_user) validate_format_username "$arg" "$arg_name" ;;
template) validate_format_username "$arg" "$arg_name" ;;
ttl) validate_format_int "$arg" ;;
url) validate_format_url "$arg" ;;
user) validate_format_username "$arg" ;;
wday) validate_format_mhdmw "$arg" $arg_name ;;
esac