소스 검색

Merge pull request #1170 from demlasjr/patch-3

Fixing duplicate of lines in 01_caching_pool.conf
Anton Reutov 8 년 전
부모
커밋
747be85de6
1개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 4
      install/ubuntu/16.04/templates/web/nginx/caching.sh

+ 10 - 4
install/ubuntu/16.04/templates/web/nginx/caching.sh

@@ -6,7 +6,13 @@ ip=$3
 home=$4
 home=$4
 docroot=$5
 docroot=$5
 
 
-str="proxy_cache_path /var/cache/nginx/$domain levels=2"
-str="$str keys_zone=$domain:10m inactive=60m max_size=512m;"
-echo "$str" >> /etc/nginx/conf.d/01_caching_pool.conf
-
+str="proxy_cache_path /var/cache/nginx/$domain levels=2" 
+str="$str keys_zone=$domain:10m inactive=60m max_size=512m;" 
+conf='/etc/nginx/conf.d/01_caching_pool.conf'
+if [ -e "$conf" ]; then
+    if [ -z "$(grep "=${domain}:" $conf)" ]; then
+        echo "$str" >> $conf
+    fi
+else
+    echo "$str" >> $conf
+fi