Varnish

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. You can easily add it to your Lando app by adding an entry to the services key in your app's .lando.yml.

Supported versions

  • 4.1 (default)
  • custom

Using patch versions

Because we use our own custom image for php specifying a patch version is not currently supported. If you need to use a patch version you might be able to use our advanced service config.

Example

# Varnish recipe example
name: varnish

# Start with the default LEMP recipe
recipe: lemp

# Override lemp proxy settings because we want varnish to get hit on requests
# to port 80 and the edge-ssl to get requests from port 443
proxy:

  # Empty the proxy settings provided by lemp recipe
  nginx:

  # Replace with our varnish and ssl termination endpoints
  edge:
    - varnish.lndo.site

# Set up my services
services:

  # Lets set up an edge
  edge:
    type: varnish:4.1

    # Specify the backend(s) that varnish should attempt to connect to
    #
    # This can be an array or string and should be the names of other services
    # provided directly by this file or by a recipe. You can discover the services
    # your app has by running `lando info`
    #
    backends:
      - nginx

    # Optionally spin up another nginx instance so that you can secure your
    # traffic over ssl
    #
    # The varnish ssl service will be called NAME_ssl, or edge_ssl in this
    # example
    #
    ssl: true

    # Optionally load in a custom vcl file. This is relative to the app root
    #
    # You will not need to import the standard library or manage backends in this
    # file. Those are handled automatically.
    #
    vcl: custom.vcl

    # There are various envvars you can specify to further customize how your
    # varnish works.
    #
    # See: https://hub.docker.com/r/eeacms/varnish/
    # Note: We set BACKENDS_PROBE_ENABLED to false by default
    #
    # overrides:
      # services:
        # environment:
          # BACKENDS_PROBE_ENABLED: false
          # BACKENDS_PORT: 8080
          # DNS_ENABLED: true
          # BACKENDS_PROBE_INTERVAL: 3s
          # BACKENDS_PROBE_TIMEOUT: 1s
          # BACKENDS_PROBE_WINDOW: 3
          # BACKENDS_PROBE_THRESHOLD: 2

# Add in routes to the varnish cli tools
tooling:
  varnishadm:
    service: edge
    user: root
  varnishstat:
    service: edge
    user: root
  varnishlog:
    service: edge
    user: root

You will need to rebuild your app with lando rebuild to apply the changes to this file. You can check out the full code for this example over here.

results matching ""

    No results matching ""