1

I have varnish configured and "working" on port 80. I have apache running a few instances of Drupal 6 on port 8080. One for dev, review and one for production. I used the four kitchens vcl file as a guide in setting things up. But I'm wondering if I need to do more configuration in the VCL to separate these environments? Perhaps separate backends? I'm not sure when this is necessary.

In addition to this, I am not getting any (or very few) hits, mostly misses which indicates something isn't working correctly.

For reference, my vhosts looks like this...

NameVirtualHost *:8080
<VirtualHost *:8080>
        ServerAdmin [email protected]
        ServerName www.mysite.com
        ServerAlias mysite.com
        DocumentRoot /var/www/prod/httpdocs
        ErrorLog /var/www/logs/prod_error.log
        CustomLog /var/www/logs/prod_access.log combined

        <directory "/var/www/prod/httpdocs/">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride All
                Order allow,deny
                Allow from all
        </directory>

</VirtualHost>

<VirtualHost *:8080>
        ServerAdmin [email protected]
        ServerName test.mysite.com
        DocumentRoot /var/www/test/httpdocs
        ErrorLog /var/www/logs/test_error.log
        CustomLog /var/www/logs/test_access.log combined

        <directory "/var/www/test/httpdocs/">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride All
                Order allow,deny
                Allow from all
        </directory>

</VirtualHost>

Feel free to call out anything else you see wrong with how I have configured things in apache.

Additionally, what can I do if I want my dev environment to skip caching all together?

Thanks

3
  • Hard to tell what does your logs say?
    – chrisjlee
    Mar 20, 2013 at 4:37
  • The varnish logs are exhaustive. Is there a simpler way I investigate, or a way I can make the varnish log more comprehendible. Mar 20, 2013 at 12:49
  • Consider using Pressflow instead of the standard distro of Drupal. It integrates better with Varnish. Also you may need to tweak the Varnish rules to override the default cookie handling. Mar 21, 2013 at 13:28

1 Answer 1

1

You may setup different VCL configurations for your environments.

It can be easily done with wrapping them by host condition:

sub vcl_recv {
if (req.http.Host ~ "^example.com")
 {
 ...
  if (req.url ~ "^/something") {
   return(pass);
  }
 ...
}
}

Please, take a look on my blog post http://blog.tenya.me/blog/2011/12/19/varnish-simple-virtual-hosts/, it describes how to do configuration separation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.