Skip to content

Commit 58182e8

Browse files
authored
Delete old configuration when changing template
When we want to change nginx template. The current hestiacp will only check if there is a 'proxy_cache_path' setting for this domain in '/etc/nginx/conf.d/01_caching_pool.conf'. if there is, hestia will skip adding config again. Because hestia will assume the configuration still the same. Remember, Other template can also change this config. We need to delete previous config and reinstall our config again. Just to make sure if other template changing "proxy_cache_path" configuration. for example: -) previous template changed " keys_zone" parameter, when we changed to 'caching' template. it will cause: "new_name" zone "example.com" is unknown -) previous template changed "levels" parameter, when we changed to 'caching' template. it will cause: "example.com" had previously different levels
1 parent 1280c82 commit 58182e8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

install/deb/templates/web/nginx/caching.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ str="proxy_cache_path /var/cache/nginx/$domain levels=2"
1010
str="$str keys_zone=$domain:10m inactive=60m max_size=512m;"
1111
conf='/etc/nginx/conf.d/01_caching_pool.conf'
1212
if [ -e "$conf" ]; then
13+
if [ -n "$(grep "=${domain}:" $conf)" ]; then
14+
sed -i "/=${domain}:/d" $conf
15+
fi
1316
if [ -z "$(grep "=${domain}:" $conf)" ]; then
1417
echo "$str" >> $conf
1518
fi

0 commit comments

Comments
 (0)