Просмотр исходного кода

Merge pull request #2043 from erikdemarco/patch-1

Delete old configuration before changing to "caching" template
Jaap Marcus 4 лет назад
Родитель
Сommit
2304b935db
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      install/deb/templates/web/nginx/caching.sh

+ 3 - 5
install/deb/templates/web/nginx/caching.sh

@@ -10,10 +10,8 @@ str="proxy_cache_path /var/cache/nginx/$domain levels=1:2"
 str="$str keys_zone=$domain:10m max_size=256m inactive=30m;" 
 conf='/etc/nginx/conf.d/01_caching_pool.conf'
 if [ -e "$conf" ]; then
-    if [ -z "$(grep "=${domain}:" $conf)" ]; then
-        echo "$str" >> $conf
+    if [ -n "$(grep "=${domain}:" $conf)" ]; then
+        sed -i "/=${domain}:/d" $conf
     fi
-else
-    echo "$str" >> $conf
 fi
-
+echo "$str" >> $conf