Skip to content

Instantly share code, notes, and snippets.

@suriyaa
Created July 7, 2017 11:04
Show Gist options
  • Save suriyaa/bf990890726c5cb13cf28124c53d14eb to your computer and use it in GitHub Desktop.
Save suriyaa/bf990890726c5cb13cf28124c53d14eb to your computer and use it in GitHub Desktop.
Install Varnish Cache on Windows with cygwin

Varnish Cache on Windows

Build instructions with cygport packages (for development)

Cygport source packages can be build using cygport program. Cygport can be installed using cygwin setup.exe.

  • Install CYGWIN environment with cygport tool

  • Download cygport varnish-*-src.tar.xz varnish package files from https://sourceforge.net/projects/cygvarnish/files/cygport-packages/

  • Uncompress tar.xz files to /usr/src directory (All files!)

  • Enter the directory in cygwin: cd /cygdrive/c/cygwin64/usr/src

  • Execute cygport commands:

    cygport varnish-{version}.cygport prep
    cygport varnish-{version}.cygport compile
    cygport varnish-{version}.cygport install 
    
  • Compiled binaries are copied to varnish-{version}/inst

In my case:

cd /cygdrive/c/cygwin64/usr/src
cygport varnish-4.1.0-1.cygport prep
cygport varnish-4.1.0-1.cygport compile
cygport varnish-4.1.0-1.cygport install

Install Full Cygwin environment with varnish package (for production)

The tar.xz package file is installed inside Cygwin environment using cygwin installer:

Follow this steps:

  • Download setup-x64.exe (32 bits) or setup-x86_64.exe (64 bits) at localhost.
  • Install CYGWIN enviroment executing installer.

On package selection list, select varnish package from package list in Web category, package will be download from cygwin servers:

Varnish Package Selection in from Cygwin package list in Web category

Install varnishd as a Windows service

Run as an administrator:

cygrunsrv --install varnishd --path /cygdrive/c/cygwin64/usr/sbin/varnishd.exe

or

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"

Uninstall varnishd as a Windows service

Run as an administrator:

cygrunsrv --remove varnishd

Start varnishd as a Windows service

cygrunsrv --start varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000

or

cygrunsrv --start varnish

Stop varnishd as a Windows service

cygrunsrv --stop

Helpful resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment