2011-04-21 5 views
2

광택재의 제거 구성에 문제가 있습니다. 아래에 구성한 제거 URL이 있지만 서비스를 시작하려고 할 때 아래에 오류가 발생합니다. 이 구성 부분을 주석 처리하면 서비스가 문제없이 시작됩니다. 누구든지 내가 잘못 가고있는 아이디어가 있습니까?시동 오류가 발생하는 바니시 제거 구성

건배.

sub vcl_recv { 
    #purge all 
    if (req.request == "PURGE") { 
    if (!client.ip ~ purge) { 
     error 405 "Not allowed."; 
    } 
    if (req.url ~ "varnish/index/purgeall/key/#Fj1nzljh") { 
     purge_hash(".*"); 
    } 
    } 

시작시 오류 메시지가 읽

[email protected]:/var/www$ sudo service varnish start 
* Starting HTTP accelerator varnishd         [fail] 
storage_file: filename: /var/lib/varnish/ubuntu/varnish_storage.bin size 1024 MB. 
Message from VCC-compiler: 
Expected an action, 'if', '{' or '}' 
(input Line 18 Pos 7) 
     purge_hash(".*"); 
------##########--------- 
Running VCC-compiler failed, exit 1 
VCL compilation failed 
[email protected]:/var/www$ sudo service varnish start 
* Starting HTTP accelerator varnishd                                      [fail] 
storage_file: filename: /var/lib/varnish/ubuntu/varnish_storage.bin size 1024 MB. 
Message from VCC-compiler: 
Expected an action, 'if', '{' or '}' 
(input Line 18 Pos 7) 
     purge_hash(".*"); 

답변

1

3.0.x에서이 작업을 수행하는 올바른 방법은 다음과 같습니다.

acl our_lan { 
    "localhost"; 
    "10.0.0.0"/8; 
    "192.168.0.0"/16; 
} 

sub vcl_recv { 
    # ... 
    if (req.request == "PURGE") { 
     if (! (client.ip ~ our_lan)) { 
      error 405 "Not allowed."; 
     } 
     return (lookup); 
    } 
    # ... 
} 

sub vcl_hit { 
    if (req.request == "PURGE") { 
     purge; 
     error 200 "Purged."; 
    } 
} 

sub vcl_miss { 
    if (req.request == "PURGE") { 
     error 200 "OK: but URL not in cache."; 
    } 
} 

YMMV.