简体   繁体   English

如何配置Varnish VCL文件以缓存OSCommerce站点?

[英]How to configure Varnish VCL file for caching OSCommerce site?

I'm building a simple server setup for developping purposes, with Nginx, PHP-FPM, APC, Varnish and MySQL, using Ubuntu Server 12.04. 我正在使用Ubuntu Server 12.04使用Nginx,PHP-FPM,APC,Varnish和MySQL构建用于开发目的的简单服务器设置。

But now I want to deploy at this testing environment, an OSCommerce app. 但是现在我想在这个测试环境中部署一个OSCommerce应用程序。 After some googling I couldn't find a way to properly configure OSCommerce with Varnish. 经过一番谷歌搜索后,我找不到使用Varnish正确配置OSCommerce的方法。

Actually I have Varnish configured for Wordpress (varnish file and default.vcl file) like one from there ( GitHub-Nicolargo ) but just a little bit modded. 实际上,我已经为其中的Wordpress配置了Varnish(清漆文件和default.vcl文件),就像从那里配置的那样( GitHub-Nicolargo ),但只是进行了一点修改。

So, should I use the same configuration for WP? 那么,我应该对WP使用相同的配置吗? If not, There's someone who knows how (or where should I find) to configure it properly for OSCommerce? 如果不是,那么有人知道如何(或在哪里找到)为OSCommerce正确配置它?

Hugs 拥抱

Configuring Varnish for Open Source models such as Wordpress, Joomla, Drupal or OSCommerce is tricky: you can have a default VCL that works just fine in 50% of the cases, but as soon as extra modules are activated in the CMS, the caching stops working. 为诸如Wordpress,Joomla,Drupal或OSCommerce之类的开源模型配置Varnish十分棘手:您可以使用默认的VCL,在50%的情况下都可以正常工作,但是一旦在CMS中激活了额外的模块,缓存就会停止工作。 That's because each module can alter cookies, caching-headers, ... 这是因为每个模块都可以更改Cookie,缓存标题,...

That pretty much makes each Varnish implementation a custom job: you can start from a basic VCL that works for the base CMS, but it'll require finetuning specific to that site. 这几乎使每个Varnish实现都成为自定义工作:您可以从适用于基本CMS的基本VCL开始,但是需要针对该站点进行微调。

I would therefore recommend starting with a basic VCL file, such as the one you linked or that you can find here . 因此,我建议从一个基本的VCL文件开始,例如您链接的文件或可以在此处找到的文件。 Afterwards, it's a matter of running varnishlog/varnishhist/varnishstat to find out which pages are not getting cached, determining why (a combination of cookies/headers/invalid VCL) and modifying the appropriate VCL file(s). 之后,只需运行varnishlog / varnishhist / varnishstat即可找出未缓存的页面,确定原因(cookie / headers /无效的VCL的组合)并修改适当的VCL文件。

I know it's not the answer you were looking for directly, but if you could post some output of varnishlog where a request that -should- be cached is -not- being cached, we could take it from there. 我知道这不是您直接寻找的答案,但是如果您可以发布varnishlog的某些输出,在其中应缓存-不应该缓存的请求,我们可以从那里获取它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM