2011-10-31 67 views
2

在default.vcl的頂部添加一個簡單的acl以將清除請求限制爲localhost後,Varnish無法重新啓動。我的默認VCL是未經修改的。 default.vcl如下:Varnish默認VCL訪問控制列表

backend default { 
    .host = "127.0.0.1"; 
    .port = "8080"; 
} 

acl purge { 
    "localhost"; 
} 

如果我把acl聲明放在後端指令的上面或下面,沒關係。清漆版本3.0.2。

這應該是一個極其簡單的配置。

回答

2

在調試模式下運行varnishd,它應該告訴你錯誤在哪裏。例如:

# varnishd -d -f /etc/varnish/default.vcl 

Message from VCC-compiler: 
Expected an action, 'if', '{' or '}' 
('input' Line 32 Pos 6) 
    resp.http.Cache-Control = "max-age=60"; 
-----#######################---------------- 
+1

謝謝,這幫助我找到導致問題的線路。 V3中用於清除的VCL語法已更改。 https://www.varnish-cache.org/docs/3.0/tutorial/purging.html – rbaker86

1

您還可以使用編譯標誌(-C)在VCL中查找任何語法錯誤。這不會啓動任何服務器,它只是將VCL編譯爲C並打印輸出。

varnishd -C -f /etc/varnish/main.vcl