condition for a proxy

This commit is contained in:
Serghey Rodin 2013-06-19 14:59:24 +03:00
commit 82c3bad122
2 changed files with 39 additions and 33 deletions

View file

@ -70,7 +70,7 @@ if [ "$SSL" = 'yes' ]; then
fi
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
del_web_config
@ -125,19 +125,22 @@ if [ "$domains" -eq '0' ]; then
rm -f $HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf
fi
# Checking last SSL proxy
conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf"
last_sproxy=$(grep "SSL='yes'" $USER_DATA/web.conf)
if [ -z "$last_sproxy" ]; then
sed -i "/.*\/$user\/.*s$PROXY_SYSTEM.conf/d" $conf
rm -f $HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf
fi
# Proxy
if [ ! -z "$PROXY_SYSTEM" ]; then
# Checking last SSL proxy
conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf"
last_sproxy=$(grep "SSL='yes'" $USER_DATA/web.conf)
if [ -z "$last_sproxy" ]; then
sed -i "/.*\/$user\/.*s$PROXY_SYSTEM.conf/d" $conf
rm -f $HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf
fi
# Checking last proxy
last_proxy=$(grep -v "PROXY=''" $USER_DATA/web.conf)
if [ -z "$last_proxy" ]; then
sed -i "/.*\/$user\/.*$PROXY_SYSTEM.conf/d" $conf
rm -f $HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf
# Checking last proxy
last_proxy=$(grep -v "PROXY=''" $USER_DATA/web.conf)
if [ -z "$last_proxy" ]; then
sed -i "/.*\/$user\/.*$PROXY_SYSTEM.conf/d" $conf
rm -f $HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf
fi
fi
# Decrease counters

View file

@ -258,7 +258,7 @@ if [ "$web" != 'no' ]; then
fi
# Check proxy template
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
if [ ! -e "$WEBTPL/$PROXY_SYSTEM/$TPL.tpl" ]; then
PROXY="default"
if [ ! -e "$WEBTPL/$PROXY_SYSTEM/$TPL.tpl" ]; then
@ -322,29 +322,32 @@ if [ "$web" != 'no' ]; then
echo "Include $conf" >> $web_conf
fi
# Adding proxy vhost
proxy_conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf"
if [ ! -z "$PROXY" ]; then
tmp_conf="$HOMEDIR/$user/conf/web/tmp_$PROXY_SYSTEM.conf"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
cat $tmp_conf >> $conf
rm -f $tmp_conf
fi
proxy_include=$(grep "$conf" $proxy_conf)
if [ -z "$proxy_include" ]; then
echo "include $conf;" >> $proxy_conf
fi
# Adding SSL proxy vhost
if [ ! -z "$PROXY" ] && [ "$SSL" = 'yes' ]; then
tmp_conf="$HOMEDIR/$user/conf/web/tmp_s$PROXY_SYSTEM.conf"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
cat $tmp_conf >> $conf
rm -f $tmp_conf
# Proxy
if [ ! -z "$PROXY_SYSTEM" ]; then
# Adding proxy vhost
proxy_conf="/etc/$PROXY_SYSTEM/conf.d/vesta.conf"
if [ ! -z "$PROXY" ]; then
tmp_conf="$HOMEDIR/$user/conf/web/tmp_$PROXY_SYSTEM.conf"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
cat $tmp_conf >> $conf
rm -f $tmp_conf
fi
proxy_include=$(grep "$conf" $proxy_conf)
if [ -z "$proxy_include" ]; then
echo "include $conf;" >> $proxy_conf
fi
# Adding SSL proxy vhost
if [ ! -z "$PROXY" ] && [ "$SSL" = 'yes' ]; then
tmp_conf="$HOMEDIR/$user/conf/web/tmp_s$PROXY_SYSTEM.conf"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
cat $tmp_conf >> $conf
rm -f $tmp_conf
proxy_include=$(grep "$conf" $proxy_conf)
if [ -z "$proxy_include" ]; then
echo "include $conf;" >> $proxy_conf
fi
fi
fi
fi