Jump to content

Varnish

From ArchWiki


This article or section is out of date.

Reason: The Varnish project has renamed itself to Vinyl Cache. We followed this rename with a new vinyl-cache package. This upgrade results in breaking changes and users are advised to study these changes and how it affects them before following the replacement. All references to "varnish" have been changed to "vinyl" in all binaries and directories.

https://archlinux.org/news/breaking-changes-for-all-users-of-varnish-which-is-renamed-to-vinyl-cache/

(Discuss in Talk:Varnish)


Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any HTTP server and configure it to cache the contents.

Installation

Install the varnishAUR package.

Customizing Varnish

By default, varnish comes configured in /etc/varnish/default.vcl to use localhost:8080 as the only backend, default.vcl is called by the default varnish.service file.

You can enable the unit as-is, or override the defaults by editing it.

[Service]
ExecStart=
ExecStart=/usr/bin/varnishd -j unix,user=nobody -F -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,1G

Also, if you change the configuration file /etc/varnish/default.vcl you will need to reload varnish.service:

Manual VCL load

If the previous VCL configuration reload failed, try loading the VCL file manually:

  1. Connect to the varnish console:
    $ varnishadm -T localhost:6082
  2. Load the default VCL. Make sure it has at least one backend:
    varnish> vcl.load default /etc/varnish/default.vcl
  3. Make it active:
    varnish> vcl.use default
  4. Start the child proccess (optional):
    varnish> start