@@ -148,36 +148,60 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
148148 grep " DOMAIN='$domain '" $conf > vesta/web.conf
149149
150150 # Backup vhost config
151- tpl_file=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$TPL .tpl"
152- conf=" $HOMEDIR /$user /conf/web/$WEB_SYSTEM .conf"
153- get_web_config_lines $tpl_file $conf
154- sed -n " $top_line ,$bottom_line p" $conf > conf/$WEB_SYSTEM .conf
151+ conf=$HOMEDIR /$user /conf/web/$domain .$WEB_SYSTEM .conf
152+ if [ -e " $conf " ]; then
153+ cp $conf conf/$WEB_SYSTEM .conf
154+ else
155+ # old style configs
156+ tpl_file=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$TPL .tpl"
157+ conf=" $HOMEDIR /$user /conf/web/$WEB_SYSTEM .conf"
158+ get_web_config_lines $tpl_file $conf
159+ sed -n " $top_line ,$bottom_line p" $conf > conf/$WEB_SYSTEM .conf
160+ fi
155161
156162 # Backup ssl vhost
157163 if [ " $SSL " = ' yes' ]; then
158- tpl_file=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$TPL .stpl"
159- conf=" $HOMEDIR /$user /conf/web/s$WEB_SYSTEM .conf"
160- get_web_config_lines $tpl_file $conf
161- sed -n " $top_line ,$bottom_line p" $conf > conf/s$WEB_SYSTEM .conf
164+ conf=$HOMEDIR /$user /conf/web/$domain .$WEB_SYSTEM .ssl.conf
165+ if [ -e " $conf " ]; then
166+ cp $conf conf/$WEB_SYSTEM .ssl.conf
167+ else
168+ tpl_file=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$TPL .stpl"
169+ conf=" $HOMEDIR /$user /conf/web/s$WEB_SYSTEM .conf"
170+ get_web_config_lines $tpl_file $conf
171+ sed -n " $top_line ,$bottom_line p" $conf > \
172+ conf/s$WEB_SYSTEM .conf
173+ fi
162174 fi
163175
164176 # Backup proxy config
165177 if [ ! -z " $PROXY_SYSTEM " ] && [ ! -z " $PROXY " ]; then
166- tpl_file=" $WEBTPL /$PROXY_SYSTEM /$PROXY .tpl"
167- conf=" $HOMEDIR /$user /conf/web/$PROXY_SYSTEM .conf"
168- get_web_config_lines $tpl_file $conf
169- sed -n " $top_line ,$bottom_line p" $conf > conf/$PROXY_SYSTEM .conf
178+ conf=$HOMEDIR /$user /conf/web/$domain .$PROXY_YSTEM .conf
179+ if [ -e " $conf " ]; then
180+ cp $conf conf/$PROXY_SYSTEM .conf
181+ else
182+ tpl_file=" $WEBTPL /$PROXY_SYSTEM /$PROXY .tpl"
183+ conf=" $HOMEDIR /$user /conf/web/$PROXY_SYSTEM .conf"
184+ get_web_config_lines $tpl_file $conf
185+ sed -n " $top_line ,$bottom_line p" $conf > \
186+ conf/$PROXY_SYSTEM .conf
187+ fi
170188 fi
171189
172190 # Backup ssl proxy config
173191 if [ ! -z " $PROXY_SYSTEM " ] && [ " $SSL " = ' yes' ]; then
174- tpl_file=" $WEBTPL /$PROXY_SYSTEM /$PROXY .stpl"
175- conf=" $HOMEDIR /$user /conf/web/s$PROXY_SYSTEM .conf"
176- get_web_config_lines $tpl_file $conf
177- sed -n " $top_line ,$bottom_line p" $conf > conf/s$PROXY_SYSTEM .conf
192+ conf=$HOMEDIR /$user /conf/web/$domain .$PROXY_SYSTEM .ssl.conf
193+ if [ -e " $conf " ]; then
194+ cp $conf conf/$PROXY_SYSTEM .ssl.conf
195+ else
196+ tpl_file=" $WEBTPL /$PROXY_SYSTEM /$PROXY .stpl"
197+ conf=" $HOMEDIR /$user /conf/web/s$PROXY_SYSTEM .conf"
198+ get_web_config_lines $tpl_file $conf
199+ sed -n " $top_line ,$bottom_line p" $conf > \
200+ conf/s$PROXY_SYSTEM .conf
201+ fi
178202 fi
179203
180- # Backup custom config
204+ # Backup custom config / backup LE config
181205 for sconfig in $( ls $HOMEDIR /$user /conf/web/| grep " .$domain .conf" ) ; do
182206 cp $HOMEDIR /$user /conf/web/$sconfig conf/
183207 done
0 commit comments