Optimal Varnish Configuration

We know there can be some confusion in the most optimal settings for a store running Varnish, below you'll find configurations (continually updated) to reflect the most optimal configuration.


Dynamic Content

In ___general/example.com.conf, be sure to replace,

  • lb1.i
  • example.com
# Enable If-Modified-Since
set $magestack_last_modified true;

# Enable Varnish
# Use varnish_install.sh to configure the include
# See the "Implementing Varnish" article for help
include /microcloud/data/domains/example/domains/example.com/___general/varnish.include.conf;

Static Content

In ___general/example.com.location.static.conf

# Enable If-Modified-Since
set $magestack_last_modified true;

# Enable Varnish (not recommended for static content unless using MageStack Edge)
set $magestack_cacheable false;
set $magestack_cache_lifetime 7d;

if (-f $request_filename) {
  set $magestack_clear_cookies true;
}

Semi-Static Content

In ___general/example.com.location.semi-static.conf

# Enable If-Modified-Since
set $magestack_last_modified true;

# Enable Varnish
set $magestack_cacheable true;
set $magestack_cache_lifetime 7d;

if (-f $request_filename) {
  set $magestack_clear_cookies true;
}