Skip to main content

Buildout recipe to install varnish

Project description

plone.recipe.varnish is a zc.buildout recipe to install Varnish.

Configuring it is very simple. For example:

[varnish]
recipe = plone.recipe.varnish
url = http://puzzle.dl.sourceforge.net/sourceforge/varnish/varnish-1.1.tar.gz
bind = 127.0.0.1:8000
backends = 127.0.0.1:8080
cache-size = 1G

This configures a buildout part which runs Varnish to listen on 127.0.0.1:8000 for requests, using a 1 gigabyte cache and sending requests to a backend at 127.0.0.1:8080.

Wrappers for all the varnish commands are created in the bin directory of your buildout.

Virtual hosting

Varnish supports virtual hosting by selecting a different backend server based on headers on the incoming request. You can configure the backends through the backends option:

[varnish]
backends =
   plone.org:127.0.0.1:8000
   plone.net:127.0.0.1:9000

This will generate a configuration which sends all traffic for the plone.org host to a backend server running on port 8000 while all traffic for the plone.net host is send to port 9000.

Zope hosting

If you are using Zope as backend server you will need to rewrite the URL so the Zope Virtual Host Monster can generate correct links for links in your pages. This can be done either by a web server such as Apache or nginx but can also be done by Varnish. This can be configured using the zope_vhm_map option. Here is an example:

[varnish]
zope_vhm_map =
    plone.org:/plone
    plone.net:/plone

This tells us that the domain plone.org should be mapped to the location /plone in the backend. By combing this with the information from the backends option a varnish configuration will be generated that maps URLs correctly.

Option reference

url

URL for an archive containing the Varnish sources. Either url or svn has to be specified.

svn

URL for a subversion repository containing Varnish sources. Either url or svn has to be specified.

cache-size

The size of the cache.

bind

Hostname and port on which Varnish will listen for requests. Defaults to 127.0.0.1:8000.

backends

Specifies the backend or backends which will process the (uncached) requests. There are two ways to specify backends: using hostname:backend server:backend port or backend server:backend port. Using the first option allows you to do virtual hosting. If multiple backends are specified you have to use the full form including the (virtual) hostname. Defaults to 127.0.0.1:8080.

zope_vhm_map

Defines a virtual host mapping for Zope servers. This is a list of hostname:ZODB location entries which specify the location inside Zope where the website for a virtual host lives.

telnet

If specified sets the hostname and port on which Varnish will listen for commands using its telnet interface.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plone.recipe.varnish-1.0b1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plone.recipe.varnish-1.0b1-py2.4.egg (11.2 kB view details)

Uploaded Egg

File details

Details for the file plone.recipe.varnish-1.0b1.tar.gz.

File metadata

File hashes

Hashes for plone.recipe.varnish-1.0b1.tar.gz
Algorithm Hash digest
SHA256 4f0bbd73f164415cba3884ed229bbd2fa15be77f27ed17b7f8c9e342adc6f33c
MD5 da6f93da3700c120d01f386867842147
BLAKE2b-256 8b356f1f6bfb3a522d18a2307231a061926a31e948eb8fa1d3dd2607e60759b0

See more details on using hashes here.

File details

Details for the file plone.recipe.varnish-1.0b1-py2.4.egg.

File metadata

File hashes

Hashes for plone.recipe.varnish-1.0b1-py2.4.egg
Algorithm Hash digest
SHA256 3004584647a8d93ae68e01f97d26c16b200b64b08124ab18158755840da3b207
MD5 1ee0e3cff27943f903dccd6a2ef519c9
BLAKE2b-256 bfe04320c4993df9e1ec926eb09439f3765fc7a99dd07d7d792bee0a43389f07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page