Skip to content

Commit 76edd5f

Browse files
committed
fixed nginx include bug
1 parent e4d8175 commit 76edd5f

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

bin/v_add_web_domain_nginx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,25 @@ conf="$V_HOME/$user/conf/nginx.conf"
7373
upd_web_domain_values
7474
add_web_config
7575

76+
# Checking main vesta httpd config
77+
main_conf='/etc/nginx/conf.d/vesta_users.conf'
78+
main_conf_check=$(grep "$conf" $main_conf )
79+
if [ -z "$main_conf_check" ]; then
80+
echo "include $conf;" >>$main_conf
81+
fi
82+
83+
7684
if [ "$SSL" = 'yes' ]; then
7785
proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
7886
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
7987
conf="$V_HOME/$user/conf/snginx.conf"
8088
add_web_config
89+
90+
main_conf='/etc/nginx/conf.d/vesta_users.conf'
91+
main_conf_check=$(grep "$conf" $main_conf )
92+
if [ -z "$main_conf_check" ]; then
93+
echo "include $conf;" >>$main_conf
94+
fi
8195
fi
8296

8397

bin/v_delete_web_domain_nginx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,12 @@ conf='/etc/nginx/conf.d/vesta_users.conf'
8181
last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
8282
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
8383
if [ -z "$last_snginx" ]; then
84-
sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : )
85-
if [ ! -z "$sline" ]; then
86-
sed -i "$sline d" $conf
87-
fi
84+
sed -i "/$user\/conf\/snginx.conf/d" $conf
8885
rm -f $V_HOME/$user/conf/snginx.conf
8986
fi
9087

9188
if [ -z "$last_nginx" ]; then
92-
line=$(grep -n "$V_HOME/$user/conf/nginx.conf" $conf | cut -f 1 -d : )
93-
if [ ! -z "$line" ]; then
94-
sed -i "$line d" $conf
95-
fi
89+
sed -i "/$user\/conf\/nginx.conf/d" $conf
9690
rm -f $V_HOME/$user/conf/nginx.conf
9791
fi
9892

bin/v_delete_web_domain_ssl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ conf='/etc/nginx/conf.d/vesta_users.conf'
9797
last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
9898
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
9999
if [ -z "$last_snginx" ]; then
100-
sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : )
101-
if [ ! -z "$sline" ]; then
102-
sed -i "$sline d" $conf
103-
fi
100+
if [ -z "$last_nginx" ]; then
101+
sed -i "/$user\/conf\/snginx.conf/d" $conf
104102
rm -f $V_HOME/$user/conf/snginx.conf
105103
fi
106104

0 commit comments

Comments
 (0)