Skip to content

Commit cd69b7b

Browse files
committed
improving template structure
1 parent fce5dde commit cd69b7b

23 files changed

+135
-88
lines changed

bin/v-add-web-domain

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ group="$user"
8383
email="$user@$domain"
8484
docroot="$HOMEDIR/$user/web/$domain/public_html"
8585
conf="$HOMEDIR/$user/conf/web/httpd.conf"
86-
tpl_file="$WEBTPL/apache_$template.tpl"
86+
tpl_file="$WEBTPL/apache/$template.tpl"
8787

8888
# Adding domain to the httpd.conf
8989
add_web_config
@@ -146,8 +146,8 @@ chmod 551 $HOMEDIR/$user/web/$domain/logs
146146
chmod 640 /var/log/httpd/domains/$domain.*
147147

148148
# Running template trigger
149-
if [ -x $WEBTPL/apache_$template.sh ]; then
150-
$WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot
149+
if [ -x $WEBTPL/apache/$template.sh ]; then
150+
$WEBTPL/apache/$template.sh $user $domain $ip $HOMEDIR $docroot
151151
fi
152152

153153
# Checking main vesta httpd config

bin/v-add-web-domain-alias

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ is_package_full 'WEB_ALIASES'
4949

5050
# Parsing domain values
5151
get_domain_values 'web'
52-
tpl_file="$WEBTPL/apache_$TPL.tpl"
52+
tpl_file="$WEBTPL/apache/$TPL.tpl"
5353
conf="$HOMEDIR/$user/conf/web/httpd.conf"
5454
ip=$(get_real_ip $IP)
5555

@@ -68,21 +68,21 @@ del_web_config
6868
add_web_config
6969

7070
if [ "$SSL" = 'yes' ]; then
71-
tpl_file="$WEBTPL/apache_$TPL.stpl"
71+
tpl_file="$WEBTPL/apache/$TPL.stpl"
7272
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
7373
del_web_config
7474
add_web_config
7575
fi
7676

7777
# Checking nginx
7878
if [ ! -z "$NGINX" ]; then
79-
tpl_file="$WEBTPL/nginx_$NGINX.tpl"
79+
tpl_file="$WEBTPL/nginx/$NGINX.tpl"
8080
conf="$HOMEDIR/$user/conf/web/nginx.conf"
8181
del_web_config
8282
add_web_config
8383

8484
if [ "$SSL" = 'yes' ]; then
85-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
85+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
8686
conf="$HOMEDIR/$user/conf/web/snginx.conf"
8787
del_web_config
8888
add_web_config

bin/v-add-web-domain-nginx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fi
5656
get_domain_values 'web'
5757
NGINX="$template"
5858
NGINX_EXT="$extentions"
59-
tpl_file="$WEBTPL/nginx_$NGINX.tpl"
59+
tpl_file="$WEBTPL/nginx/$NGINX.tpl"
6060
conf="$HOMEDIR/$user/conf/web/nginx.conf"
6161
ip=$(get_real_ip $IP)
6262

@@ -77,7 +77,7 @@ fi
7777

7878
# Checking ssl
7979
if [ "$SSL" = 'yes' ]; then
80-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
80+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
8181
conf="$HOMEDIR/$user/conf/web/snginx.conf"
8282
add_web_config
8383

bin/v-add-web-domain-ssl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ chmod 660 $USER_DATA/ssl/$domain.*
6363
# Parsing domain values
6464
get_domain_values 'web'
6565
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
66-
tpl_file="$WEBTPL/apache_$TPL.stpl"
66+
tpl_file="$WEBTPL/apache/$TPL.stpl"
6767
SSL_HOME="$ssl_home"
6868
ip=$(get_real_ip $IP)
6969

@@ -85,8 +85,8 @@ if [ -e "$USER_DATA/ssl/$domain.ca" ]; then
8585
fi
8686

8787
# Running template trigger
88-
if [ -x $WEBTPL/apache_$template.sh ]; then
89-
$WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $sdocroot
88+
if [ -x $WEBTPL/apache/$template.sh ]; then
89+
$WEBTPL/apache/$template.sh $user $domain $ip $HOMEDIR $sdocroot
9090
fi
9191

9292
# Checking main vesta httpd config
@@ -100,7 +100,7 @@ fi
100100
if [ ! -z "$NGINX" ]; then
101101
# Adding domain to the snginx.conf
102102
conf="$HOMEDIR/$user/conf/web/snginx.conf"
103-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
103+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
104104
add_web_config
105105

106106
chown root:nginx $conf

bin/v-add-web-domain-stats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ get_domain_values 'web'
5151
upd_web_domain_values
5252

5353
# Adding statistic config
54-
cat $WEBTPL/$type.tpl |\
54+
cat $WEBTPL/$type/$type.tpl |\
5555
sed -e "s/%ip%/$ip/g" \
5656
-e "s/%web_port%/$WEB_PORT/g" \
5757
-e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \

bin/v-backup-user

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ then
169169
# Apache config
170170
if [ "$WEB_SYSTEM" = 'apache' ]; then
171171
# Parsing httpd.conf
172-
tpl_file="$WEBTPL/apache_$TPL.tpl"
172+
tpl_file="$WEBTPL/apache/$TPL.tpl"
173173
conf="$HOMEDIR/$user/conf/web/httpd.conf"
174174
get_web_config_brds
175175
sed -n "$top_line,$bottom_line p" $conf > conf/httpd.conf
176176

177177
# SSL check
178178
if [ "$SSL" = 'yes' ]; then
179-
tpl_file="$WEBTPL/apache_$TPL.stpl"
179+
tpl_file="$WEBTPL/apache/$TPL.stpl"
180180
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
181181
get_web_config_brds
182182
sed -n "$top_line,$bottom_line p" $conf > conf/shttpd.conf
@@ -185,14 +185,14 @@ then
185185

186186
# Nginx config
187187
if [ ! -z "$NGINX" ] ; then
188-
tpl_file="$WEBTPL/nginx_$NGINX.tpl"
188+
tpl_file="$WEBTPL/nginx/$NGINX.tpl"
189189
conf="$HOMEDIR/$user/conf/web/nginx.conf"
190190
get_web_config_brds
191191
sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf
192192

193193
# SSL check
194194
if [ "$SSL" = 'yes' ] ; then
195-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
195+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
196196
conf="$HOMEDIR/$user/conf/web/snginx.conf"
197197
get_web_config_brds
198198
sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf

bin/v-change-web-domain-ip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,29 @@ is_ip_avalable
4646
# Define variable for replace
4747
get_domain_values 'web'
4848
ip=$(get_real_ip $ip)
49-
tpl_file="$WEBTPL/apache_$TPL.tpl"
49+
tpl_file="$WEBTPL/apache/$TPL.tpl"
5050
conf="$HOMEDIR/$user/conf/web/httpd.conf"
5151
old=$(get_real_ip $IP)
5252
new=$ip
5353
replace_web_config
5454

5555
# Checking ssl
5656
if [ "$SSL" = 'yes' ]; then
57-
tpl_file="$WEBTPL/apache_$TPL.stpl"
57+
tpl_file="$WEBTPL/apache/$TPL.stpl"
5858
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
5959
replace_web_config
6060
fi
6161

6262
# Checking nginx
6363
if [ ! -z "$NGINX" ]; then
64-
tpl_file="$WEBTPL/nginx_$NGINX.tpl"
64+
tpl_file="$WEBTPL/nginx/$NGINX.tpl"
6565
conf="$HOMEDIR/$user/conf/web/nginx.conf"
6666
replace_web_config
6767
fi
6868

6969
# Checking nginx
7070
if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then
71-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
71+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
7272
conf="$HOMEDIR/$user/conf/web/snginx.conf"
7373
replace_web_config
7474
fi

bin/v-change-web-domain-nginx-tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ is_nginx_template_valid
4949

5050
# Parsing domain values
5151
get_domain_values 'web'
52-
tpl_file="$WEBTPL/nginx_$NGINX.tpl"
52+
tpl_file="$WEBTPL/nginx/$NGINX.tpl"
5353
conf="$HOMEDIR/$user/conf/web/nginx.conf"
5454
ip=$(get_real_ip $IP)
5555

@@ -58,15 +58,15 @@ del_web_config
5858

5959
# Checking ssl
6060
if [ "$SSL" = 'yes' ]; then
61-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
61+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
6262
conf="$HOMEDIR/$user/conf/web/snginx.conf"
6363
del_web_config
6464
fi
6565

6666
# Add new vhost
6767
NGINX="$template"
6868
NGINX_EXT="$extentions"
69-
tpl_file="$WEBTPL/nginx_$NGINX.tpl"
69+
tpl_file="$WEBTPL/nginx/$NGINX.tpl"
7070
conf="$HOMEDIR/$user/conf/web/nginx.conf"
7171
upd_web_domain_values
7272
add_web_config
@@ -75,7 +75,7 @@ chmod 640 $conf
7575

7676
# Checking ssl
7777
if [ "$SSL" = 'yes' ]; then
78-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
78+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
7979
conf="$HOMEDIR/$user/conf/web/snginx.conf"
8080
add_web_config
8181
chown root:nginx $conf

bin/v-change-web-domain-sslhome

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ is_object_value_exist 'web' 'DOMAIN' "$domain" '$SSL'
3939
get_domain_values 'web'
4040
old_ssl_home=$SSL_HOME
4141
SSL_HOME=$ssl_home
42-
tpl_file="$WEBTPL/apache_$TPL.stpl"
42+
tpl_file="$WEBTPL/apache/$TPL.stpl"
4343
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
4444

4545
# Parsing tpl_option
@@ -56,8 +56,8 @@ replace_web_config
5656

5757
# Checking nginx config
5858
if [ ! -z "$NGINX" ]; then
59-
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
60-
conf="$HOMEDIR/$user/conf/web//snginx.conf"
59+
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
60+
conf="$HOMEDIR/$user/conf/web/snginx.conf"
6161
replace_web_config
6262
fi
6363

bin/v-change-web-domain-stats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
6363
upd_web_domain_values
6464

6565
# Adding statistic config
66-
cat $WEBTPL/$type.tpl |\
66+
cat $WEBTPL/$type/$type.tpl |\
6767
sed -e "s/%ip%/$ip/g" \
6868
-e "s/%web_port%/$WEB_PORT/g" \
6969
-e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \

0 commit comments

Comments
 (0)