Running Varnish on Windows 7

We are planning on using Varnish Cache 3.0.2 (latest version) for our production environment, however, for development we would like to run Varnish on our local computers, some of us have Win7.

The only easy option I could only find to install it was an older version of Varnish (2.1) bundled for Windows.

https://www.varnish-cache.org/trac/wiki/VarnishOnCygwinWindows

Are there options for building it (how?) or getting the compiled version?


Solution 1:

You're probably much better off installing a Linux distribution on a virtual machine and use the package-managed version of Varnish from that distro. It will be more similar to your production environment and easier to configure.

Solution 2:

Varnish Cache 3.0.2 is now available for Windows Cygwin, see:

  • https://www.varnish-cache.org/trac/wiki/VarnishOnCygwinWindows
  • http://sourceforge.net/projects/cygvarnish/files/windows-zip-bundle/

It was updated on December 2011

Solution 3:

  1. Install varnish and cygrunsrv with cygwin
  2. Use cygrunsrv to install service by cygwin
  3. Specify command line arguments for varnishd.exe Uncommon, but important for use with cygrunsrv: -F do not fork: otherwise cygrunsrv could not control the forked daemon process.
  4. Check that all directories and files exist:
    • /cygdrive/c/cygwin64/etc/varnish/default.vcl
    • /cygdrive/c/cygwin64/var/varnish

Full statement (use as single line) to install service:

cygrunsrv --install varnish
--path /cygdrive/c/cygwin64/usr/sbin/varnishd.exe
-a "-P /cygdrive/c/cygwin64/var/varnish/varnish.pid
   -f /cygdrive/c/cygwin64/etc/varnish/default.vcl
   -a :81 -T 127.0.0.1:6082 -t 120
   -S /cygdrive/c/cygwin64/etc/varnish/secret
   -s file,/cygdrive/c/cygwin64/var/varnish/varnish_storage.bin,2G
   -F"

Solution 4:

Varnish heavyly uses linux kernel modern abilities...using Cygwin could work but it will be a hell to compile and maintain.

Install Varnish on a Fedora VM and focus on your devs instead of dirty hacks ;o)