Skip to content

Instantly share code, notes, and snippets.

@mnocon
Last active March 2, 2018 14:00
Show Gist options
  • Save mnocon/e21af69d6c0c70925d7dbb922869a344 to your computer and use it in GitHub Desktop.
Save mnocon/e21af69d6c0c70925d7dbb922869a344 to your computer and use it in GitHub Desktop.

Steps I've done to setup Varnish:

  1. Install Varnish (with varnish modules) on Debian9 (using commands from: https://github.com/ezsystems/ezplatform-http-cache/blob/v0.4.0/docs/varnish/varnish.md) varnish is already the newest version (5.0.0-7+deb9u2). varnish-modules is already the newest version (0.9.1-4).

  2. Change Varnish to use 80 port: (I've used a mix of: http://varnish-cache.org/docs/trunk/tutorial/putting_varnish_on_port_80.html and https://stackoverflow.com/questions/40867749/varnish-wont-start-as-a-daemon with -j none for now)

  3. Use our vcl files: https://github.com/ezsystems/ezplatform-http-cache/tree/master/docs/varnish/vcl

  4. Change parameters to point to my environment:

backend ezplatform {
    .host = "sd.local";
    .port = "80";
}

(with additional hosts entry added: 192.168.33.1 sd.local so that the domain is resolved correctly)

  1. ezplatform.yml changes:
purge_type: 'http' (in http_cache section)
purge_servers: ['http://192.168.33.15:80'] (defined for main siteaccess group in http_cache section)

(as in https://doc.ezplatform.com/en/2.0/guide/http_cache/#update-yml-configuration)

  1. Apache changes:
SetEnv SYMFONY_HTTP_CACHE 0
SetEnv SYMFONY_TRUSTED_PROXIES "192.168.33.15"

(IP of the varnish instance)

(as described here: https://doc.ezplatform.com/en/2.0/guide/http_cache/#configure-ez-publish)

  1. Env cache cleared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment