Close [x]

Configure Magento to use Varnish

Edit this page on GitHub

Configure Magento to use Varnish

To configure Magento to use Varnish:

  1. Log in to the Magento Admin as an administrator.
  2. Click STORES > Configuration > ADVANCED > System > Full Page Cache
  3. From the Caching Application list, click Varnish Caching
  4. Enter a value in the TTL for public content field.
  5. Expand Varnish Configuration and enter the following information:

    Field Description
    Access list

    Enter the fully qualified host name, IP address, or Classless Inter-Domain Routing (CIDR) notation IP address range for which to invalidate content.

    More information

    Backend host

    Enter the fully qualified host name or IP address and listen port of the Varnish backend or origin server; that is, the server providing the content Varnish will accelerate. Typically, this is your web server.

    More information

    Backend port Origin server's listen port.
  6. Click Save Config.
  7. Click one of the export buttons to create a default.vcl you can use with Varnish.

    For example, if you have Varnish 4, click Export VCL for Varnish 4

    The following figure shows an example.

    Configure Magento to use Varnish in the Admin

  8. Replace your existing default.vcl with the one you just exported.
  9. Restart Varnish and your web server:

    service varnish restart
    service httpd restart
    

Last step

Final verification