From d8bee400bec53f5300ec9a8b84e9e2702d538d8b Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Tue, 24 Jan 2012 11:46:59 +0200 Subject: [PATCH] fixed nginx include bug --- bin/v_add_web_domain_nginx | 14 ++++++++++++++ bin/v_delete_web_domain_nginx | 10 ++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/bin/v_add_web_domain_nginx b/bin/v_add_web_domain_nginx index 07a4034e3..342e78201 100755 --- a/bin/v_add_web_domain_nginx +++ b/bin/v_add_web_domain_nginx @@ -73,11 +73,25 @@ conf="$V_HOME/$user/conf/nginx.conf" upd_web_domain_values add_web_config +# Checking main vesta httpd config +main_conf='/etc/nginx/conf.d/vesta_users.conf' +main_conf_check=$(grep "$conf" $main_conf ) +if [ -z "$main_conf_check" ]; then + echo "include $conf;" >>$main_conf +fi + + if [ "$SSL" = 'yes' ]; then proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;" tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl" conf="$V_HOME/$user/conf/snginx.conf" add_web_config + + main_conf='/etc/nginx/conf.d/vesta_users.conf' + main_conf_check=$(grep "$conf" $main_conf ) + if [ -z "$main_conf_check" ]; then + echo "include $conf;" >>$main_conf + fi fi diff --git a/bin/v_delete_web_domain_nginx b/bin/v_delete_web_domain_nginx index c121b168a..022f1909d 100755 --- a/bin/v_delete_web_domain_nginx +++ b/bin/v_delete_web_domain_nginx @@ -81,18 +81,12 @@ conf='/etc/nginx/conf.d/vesta_users.conf' last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf) last_snginx=$(echo "$last_nginx" | grep "SSL='yes'") if [ -z "$last_snginx" ]; then - sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : ) - if [ ! -z "$sline" ]; then - sed -i "$sline d" $conf - fi + sed -i "/$user\/conf\/snginx.conf/d" $conf rm -f $V_HOME/$user/conf/snginx.conf fi if [ -z "$last_nginx" ]; then - line=$(grep -n "$V_HOME/$user/conf/nginx.conf" $conf | cut -f 1 -d : ) - if [ ! -z "$line" ]; then - sed -i "$line d" $conf - fi + sed -i "/$user\/conf\/nginx.conf/d" $conf rm -f $V_HOME/$user/conf/nginx.conf fi