Skip to content

Commit 69006da

Browse files
committed
changed config directory strucure
1 parent ffd6e1f commit 69006da

15 files changed

+99
-95
lines changed

bin/v_add_web_domain_alias

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ is_package_full 'web_alias'
7373
# Parsing domain values
7474
get_web_domain_values
7575
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
76-
conf="$V_HOME/$user/conf/httpd.conf"
76+
conf="$V_HOME/$user/conf/web/httpd.conf"
7777

7878
# Parsing domain aliases
7979
if [ -z "$ALIAS" ]; then
@@ -91,22 +91,22 @@ add_web_config
9191

9292
if [ "$SSL" = 'yes' ]; then
9393
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
94-
conf="$V_HOME/$user/conf/shttpd.conf"
94+
conf="$V_HOME/$user/conf/web/shttpd.conf"
9595
del_web_config
9696
add_web_config
9797
fi
9898

9999
# Checking nginx
100100
if [ ! -z "$NGINX" ]; then
101101
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
102-
conf="$V_HOME/$user/conf/nginx.conf"
102+
conf="$V_HOME/$user/conf/web/nginx.conf"
103103
del_web_config
104104
add_web_config
105105

106106
if [ "$SSL" = 'yes' ]; then
107107
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
108108
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
109-
conf="$V_HOME/$user/conf/snginx.conf"
109+
conf="$V_HOME/$user/conf/web/snginx.conf"
110110
del_web_config
111111
add_web_config
112112
fi

bin/v_add_web_domain_cgi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ is_web_domain_key_empty '$CGI'
6060
# Parsing domain values
6161
get_web_domain_values
6262
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
63-
conf="$V_HOME/$user/conf/httpd.conf"
63+
conf="$V_HOME/$user/conf/web/httpd.conf"
6464
CGI='yes'
6565

6666
# Preparing domain values for the template substitution
@@ -73,7 +73,7 @@ add_web_config
7373
# Checking ssl
7474
if [ "$SSL" = 'yes' ]; then
7575
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
76-
conf="$V_HOME/$user/conf/shttpd.conf"
76+
conf="$V_HOME/$user/conf/web/shttpd.conf"
7777
del_web_config
7878
add_web_config
7979
fi

bin/v_add_web_domain_elog

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ is_web_domain_key_empty '$ELOG'
5858
# Parsing domain values
5959
get_web_domain_values
6060
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
61-
conf="$V_HOME/$user/conf/httpd.conf"
61+
conf="$V_HOME/$user/conf/web/httpd.conf"
6262
ELOG='yes'
6363

6464
# Preparing domain values for the template substitution
@@ -71,22 +71,22 @@ add_web_config
7171
# Checking ssl
7272
if [ "$SSL" = 'yes' ]; then
7373
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
74-
conf="$V_HOME/$user/conf/shttpd.conf"
74+
conf="$V_HOME/$user/conf/web/shttpd.conf"
7575
del_web_config
7676
add_web_config
7777
fi
7878

7979
# Checking nginx
8080
if [ ! -z "$NGINX" ]; then
8181
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
82-
conf="$V_HOME/$user/conf/nginx.conf"
82+
conf="$V_HOME/$user/conf/web/nginx.conf"
8383
del_web_config
8484
add_web_config
8585

8686
if [ "$SSL" = 'yes' ]; then
8787
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
8888
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
89-
conf="$V_HOME/$user/conf/snginx.conf"
89+
conf="$V_HOME/$user/conf/web/snginx.conf"
9090
del_web_config
9191
add_web_config
9292
fi

bin/v_backup_user

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,12 @@ then
156156

157157
for domain in $web_list; do
158158
echo -e "$(date "+%F %T") $domain"
159-
# Building directory tree
160159
mkdir -p $tmpdir/web/$domain/conf
161-
mkdir -p $tmpdir/web/$domain/ssl
162160

163161
# Defining domain variables
164162
domain_idn=$(idn -t --quiet -a "$domain")
165163
get_web_domain_values
166164

167-
168165
# Packing data folders
169166
cd $V_HOME/$user/web/$domain
170167
tar -cf $tmpdir/web/$domain/$domain.tar \
@@ -173,20 +170,20 @@ then
173170
# Creating web.config
174171
cd $tmpdir/web/$domain/
175172
conf="$V_USERS/$user/web.conf"
176-
grep "DOMAIN='$domain'" $conf > conf/web.conf
173+
grep "DOMAIN='$domain'" $conf > conf/vesta.conf
177174

178175
# Apache config
179176
if [ "$WEB_SYSTEM" = 'apache' ]; then
180177
# Parsing httpd.conf
181178
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
182-
conf="$V_HOME/$user/conf/httpd.conf"
179+
conf="$V_HOME/$user/conf/web/httpd.conf"
183180
get_web_config_brds
184181
sed -n "$top_line,$bottom_line p" $conf > conf/httpd.conf
185182

186183
# SSL check
187184
if [ "$SSL" = 'yes' ]; then
188185
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
189-
conf="$V_HOME/$user/conf/shttpd.conf"
186+
conf="$V_HOME/$user/conf/web/shttpd.conf"
190187
get_web_config_brds
191188
sed -n "$top_line,$bottom_line p" $conf > conf/shttpd.conf
192189
fi
@@ -195,30 +192,30 @@ then
195192
# Nginx config
196193
if [ ! -z "$NGINX" ] ; then
197194
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
198-
conf="$V_HOME/$user/conf/nginx.conf"
195+
conf="$V_HOME/$user/conf/web/nginx.conf"
199196
get_web_config_brds
200197
sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf
201198

202199
# SSL check
203200
if [ "$SSL" = 'yes' ] ; then
204201
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
205-
conf="$V_HOME/$user/conf/snginx.conf"
202+
conf="$V_HOME/$user/conf/web/snginx.conf"
206203
get_web_config_brds
207204
sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf
208205
fi
209206
fi
210207

211208
# Suplemental configs
212-
for sconfig in $(ls $V_HOME/$user/conf/|grep ".$domain.conf"); do
213-
cp $V_HOME/$user/conf/$sconfig conf/
209+
for sconfig in $(ls $V_HOME/$user/conf/web/|grep ".$domain.conf"); do
210+
cp $V_HOME/$user/conf/web/$sconfig conf/
214211
done
215212

216213
# SSL Certificates
217214
if [ "$SSL" = 'yes' ] ; then
218-
cp $V_HOME/$user/conf/ssl.$domain.* ssl/
215+
cp $V_HOME/$user/conf/web/ssl.$domain.* conf/
219216
fi
220217

221-
tar -rf $tmpdir/web/$domain/$domain.tar conf ssl
218+
tar -rf $tmpdir/web/$domain/$domain.tar conf
222219
mv $tmpdir/web/$domain/$domain.tar $tmpdir/web/
223220
rm -rf $tmpdir/web/$domain
224221

@@ -263,7 +260,7 @@ then
263260

264261
# Backingup dns recods
265262
cp $V_USERS/$user/dns/$domain $domain
266-
cp /etc/namedb/$domain.db $domain.db
263+
cp $V_USERS/$user/conf/dns/$domain.db $domain.db
267264
done
268265
echo
269266
fi

bin/v_change_web_domain_ip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,29 @@ is_ip_avalable
6060
# Define variable for replace
6161
get_web_domain_values
6262
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
63-
conf="$V_HOME/$user/conf/httpd.conf"
63+
conf="$V_HOME/$user/conf/web/httpd.conf"
6464
old=$IP
6565
new=$ip
6666
replace_web_config
6767

6868
# Checking ssl
6969
if [ "$SSL" = 'yes' ]; then
7070
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
71-
conf="$V_HOME/$user/conf/shttpd.conf"
71+
conf="$V_HOME/$user/conf/web/shttpd.conf"
7272
replace_web_config
7373
fi
7474

7575
# Checking nginx
7676
if [ ! -z "$NGINX" ]; then
7777
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
78-
conf="$V_HOME/$user/conf/nginx.conf"
78+
conf="$V_HOME/$user/conf/web/nginx.conf"
7979
replace_web_config
8080
fi
8181

8282
# Checking nginx
8383
if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then
8484
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
85-
conf="$V_HOME/$user/conf/snginx.conf"
85+
conf="$V_HOME/$user/conf/web/snginx.conf"
8686
replace_web_config
8787
fi
8888

bin/v_change_web_domain_tpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ get_web_domain_values
6363
# Deleting domain
6464
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
6565
old_tpl=$TPL
66-
conf="$V_HOME/$user/conf/httpd.conf"
66+
conf="$V_HOME/$user/conf/web/httpd.conf"
6767
del_web_config
6868

6969
# Deleting ssl vhost
7070
if [ "$SSL" = 'yes' ]; then
7171
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
72-
conf="$V_HOME/$user/conf/shttpd.conf"
72+
conf="$V_HOME/$user/conf/web/shttpd.conf"
7373
del_web_config
7474
fi
7575

@@ -79,7 +79,7 @@ email="$user@$domain"
7979
group="$user"
8080
docroot="$V_HOME/$user/web/$domain/public_html"
8181
docroot_string="DocumentRoot $docroot"
82-
conf="$V_HOME/$user/conf/httpd.conf"
82+
conf="$V_HOME/$user/conf/web/httpd.conf"
8383
tpl_file="$V_WEBTPL/apache_$template.tpl"
8484

8585

@@ -147,18 +147,18 @@ fi
147147
# Checking ssl
148148
if [ "$SSL" = 'yes' ]; then
149149
# Defining SSL vars
150-
ssl_crt="$V_HOME/$user/conf/ssl.$domain.crt"
151-
ssl_key="$V_HOME/$user/conf/ssl.$domain.key"
152-
ssl_pem="$V_HOME/$user/conf/ssl.$domain.pem"
153-
ssl_ca="$V_HOME/$user/conf/ssl.$domain.ca"
154-
if [ ! -e "$V_USERS/$user/ssl/$domain.ca" ]; then
150+
ssl_crt="$V_HOME/$user/conf/web/ssl.$domain.crt"
151+
ssl_key="$V_HOME/$user/conf/web/ssl.$domain.key"
152+
ssl_pem="$V_HOME/$user/conf/web/ssl.$domain.pem"
153+
ssl_ca="$V_HOME/$user/conf/web/ssl.$domain.ca"
154+
if [ ! -e "$V_USERS/$user/web/ssl/$domain.ca" ]; then
155155
ssl_ca_str='#'
156156
fi
157157
case $SSL_HOME in
158158
single) docroot="$V_HOME/$user/web/$domain/public_shtml" ;;
159159
same) docroot="$V_HOME/$user/web/$domain/public_html" ;;
160160
esac
161-
conf="$V_HOME/$user/conf/shttpd.conf"
161+
conf="$V_HOME/$user/conf/web/shttpd.conf"
162162
tpl_file="$V_WEBTPL/apache_$template.stpl"
163163

164164
# Adding domain to the httpd.conf

bin/v_delete_web_domain

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,58 +58,49 @@ is_domain_suspended 'web'
5858
# Get template name
5959
get_web_domain_values
6060
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
61-
conf="$V_HOME/$user/conf/httpd.conf"
61+
conf="$V_HOME/$user/conf/web/httpd.conf"
6262

6363
# Deleting domain
6464
del_web_config
6565

6666
# Checking ssl
6767
if [ "$SSL" = 'yes' ]; then
6868
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
69-
conf="$V_HOME/$user/conf/shttpd.conf"
69+
conf="$V_HOME/$user/conf/web/shttpd.conf"
7070
del_web_config
7171

7272
# Deleting certificates
73-
rm -f $V_HOME/$user/conf/ssl.$domain.*
73+
rm -f $V_HOME/$user/conf/web/ssl.$domain.*
7474
rm -f $V_USERS/$user/ssl/$domain.*
7575
fi
7676

7777
# Checking nginx
7878
if [ ! -z "$NGINX" ]; then
7979
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
80-
conf="$V_HOME/$user/conf/nginx.conf"
80+
conf="$V_HOME/$user/conf/web/nginx.conf"
8181
del_web_config
8282

8383
if [ "$SSL" = 'yes' ]; then
8484
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
8585
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
86-
conf="$V_HOME/$user/conf/snginx.conf"
86+
conf="$V_HOME/$user/conf/web/snginx.conf"
8787
del_web_config
8888
fi
8989
fi
9090

9191
# Checking stats
9292
if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
93-
# Parsing pipe line
94-
line=$(grep -n "$STATS.$domain.conf" $V_QUEUE/stats.pipe | \
95-
cut -f 1 -d : | head -n 1 )
96-
97-
# Deleting pipe command
98-
if [ ! -z "$line" ]; then
99-
sed -i "$line d" $V_QUEUE/stats.pipe
100-
fi
101-
102-
# Deleteing config
103-
rm -f $V_HOME/$user/conf/$STATS.$domain.conf
93+
sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
94+
rm -f $V_HOME/$user/conf/web/$STATS.$domain.conf
10495
fi
10596

10697
# Deleting directory
10798
rm -rf $V_HOME/$user/web/$domain
10899

109100
# Deleting logs
110-
rm -rf /var/log/httpd/domains/$domain.log*
111-
rm -rf /var/log/httpd/domains/$domain.bytes
112-
rm -rf /var/log/httpd/domains/$domain.error*
101+
rm -f /var/log/httpd/domains/$domain.log*
102+
rm -f /var/log/httpd/domains/$domain.bytes
103+
rm -f /var/log/httpd/domains/$domain.error*
113104

114105

115106
#----------------------------------------------------------#
@@ -122,14 +113,14 @@ del_web_domain
122113
# Checking last ssl domain
123114
ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf | wc -l)
124115
if [ "$ssl_dom" -eq '0' ]; then
125-
sed -i "s/ Include /#Include /" $V_HOME/$user/conf/httpd.conf
116+
sed -i "s/ Include /#Include /" $V_HOME/$user/conf/web/httpd.conf
126117
fi
127118

128119
# Checking last domain
129120
domains=$(wc -l $V_USERS/$user/web.conf|cut -f 1 -d ' ')
130121
if [ "$domains" -eq '0' ]; then
131122
conf='/etc/httpd/conf.d/vesta.conf'
132-
line=$(grep -n "$V_HOME/$user/conf/httpd.conf" $conf | cut -f 1 -d : )
123+
line=$(grep -n "$V_HOME/$user/conf/web/httpd.conf" $conf | cut -f 1 -d : )
133124
if [ ! -z "$line" ]; then
134125
sed -i "$line d" $conf
135126
fi
@@ -140,19 +131,19 @@ conf='/etc/nginx/conf.d/vesta_users.conf'
140131
last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
141132
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
142133
if [ -z "$last_snginx" ]; then
143-
sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : )
134+
sline=$(grep -n "$V_HOME/$user/conf/web/snginx.conf" $conf |cut -f 1 -d :)
144135
if [ ! -z "$sline" ]; then
145136
sed -i "$sline d" $conf
146137
fi
147-
rm -f $V_HOME/$user/conf/snginx.conf
138+
rm -f $V_HOME/$user/conf/web/snginx.conf
148139
fi
149140

150141
if [ -z "$last_nginx" ]; then
151-
line=$(grep -n "$V_HOME/$user/conf/nginx.conf" $conf | cut -f 1 -d : )
142+
line=$(grep -n "$V_HOME/$user/conf/web/nginx.conf" $conf | cut -f 1 -d : )
152143
if [ ! -z "$line" ]; then
153144
sed -i "$line d" $conf
154145
fi
155-
rm -f $V_HOME/$user/conf/nginx.conf
146+
rm -f $V_HOME/$user/conf/web/nginx.conf
156147
fi
157148

158149
# Decreasing ip value

0 commit comments

Comments
 (0)