varnish3.x清除缓存方法

varnish logo

首先吐槽一下varnish文档的匮乏,不管中文还是英文文档都比nginx之流少的可怜。而且尤其是2.x和3.x版本语法各种不一样,网上中文的文档基本都是从张宴的使用Varnish代替Squid做网站缓存加速器的详细解决方案[原创]文章上衍生或者甚至只是复制过去的。

vainish2.x版本都是通过varnishadm -T 127.0.0.1:3500 url.purge w*$方式清空缓存,而且张宴的文章中没有提及auth验证的问题。当然因为张宴的文章中并没有任何引入-S这个参数,所以也就无需做任何验证即可清除缓存。

而我上篇文章中的启动参数是有使用-S /etc/varnish/secret这个参数的。所以在清空缓存时候也需要指定此参数。如果清除缓存时候不指定此参数varnish会提示Authentication required。这个提示Google了一下午才找到原因所在。

所以最终我的清除缓存的命令就是:varnishadm -T 127.0.0.1:3500 -S /etc/varnish/secret ban.url xxx

同样2.x是使用purge清除缓存,而3.x则变成了ban……2.x和3.x的区别可以参考官方的此链接,再次吐槽官方的文档:有的地方根本连的demo都懒得写啊,当大家都会去读他的源码么……

最后放一个别人写的shell脚本用来清除缓存,未测试仅供参考:http://www.gossamer-threads.com/lists/varnish/misc/25477

已有266条评论 »

  1. Hello! cialis online , indian viagra , discount cialis , cash advance ,

  2. Hello! buy cheap cialis , viagra , buy cheap cialis , viagra , viagra online ,

  3. Hello! safe online viagra 25mg , best Ala. cash advance , how do you get a small loan with no credit , payday loans walnut ca ,

  4. Hello! payday loan payday loans , cheap viagra , loans for bad credit ,

  5. Hello! viagra coupon , viagra india generic ,

  6. Hello! online viagra ,

  7. Hello! generic cialis , cialis cheap ,

  8. Hello! buy viagra ,

  9. Hello! cheap viagra , cialis cheap , cheap viagra ,

  10. Hello! generic viagra , generic viagra , buy cialis online , canadian viagra ,

  11. day

    Hello! online cialis , pay day loans , online payday loan , buy viagra online ,

  12. Hello! payday loans online , viagra , buy cialis , cash advance ,

  13. Hello! viagra| buy viagra| viagra online| generic viagra online| viagra coupon| buy viagra online| generic viagra| cheap viagra| order viagra| buy generic viagra| cheap viagra online , viagra|generic viagra|buy viagra|buy viagra online|viagra online|viagra generic|viagra super active plus|viagra super active|viagra professional|cheap viagra|viagra cheap , buy cialis online|buy cialis|cialis generic|generic cialis|cialis online|cilais price|cheap cialis|cialis cheap|order cialis ,

  14. Hello! buy cialis online|buy cialis|cialis generic|generic cialis|cialis online|cilais price|cheap cialis|cialis cheap|order cialis , viagra| buy viagra| viagra online| generic viagra online| viagra coupon| buy viagra online| generic viagra| cheap viagra| order viagra| buy generic viagra| cheap viagra online , buy cialis online|buy cialis|cialis generic|generic cialis|cialis online|cilais price|cheap cialis|cialis cheap|order cialis , viagra| buy viagra| viagra online| generic viagra online| viagra coupon| buy viagra online| generic viagra| cheap viagra| order viagra| buy generic viagra| cheap viagra online , buy cialis online|buy cialis|cialis generic|generic cialis|cialis online|cilais price|cheap cialis|cialis cheap|order cialis ,

  15. Hello! buy generic viagra , fast payday loans , online payday advance , buy cialis online , viagra buy ,

  16. Hello! advance payday service , cheap viagra online , tadalafil ,

  17. https://www.idshome.cc/south-carolina-sc-fake-ids-p-8.html https://www.idshome.cc/rhode-island-ri-fake-ids-p-7.html https://www.idshome.cc/

  18. SPECIAL OFFER : cash advance loans in virginia For Women Herbal on SALE , Buy Viagra For Women Herbal shop online .

  19. Hello! cheap cialis , viagra online , generic viagra , cheap viagra ,

  20. Hello! cialis online , viagra ,

添加新评论 »