Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bmunoz89/1ac1cc61653ee57a0bf9988583c2237c to your computer and use it in GitHub Desktop.
Save bmunoz89/1ac1cc61653ee57a0bf9988583c2237c to your computer and use it in GitHub Desktop.

Varnish 4

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish41/script.deb.sh | sudo bash

Fix poll param in varnish configuration

sudo nano /usr/share/varnish/reload-vcl

-while getopts a:b:CdFf:g:h:i:l:M:n:P:p:S:s:T:t:u:Vw: flag $DAEMON_OPTS
+while getopts a:b:CdFf:g:h:i:l:M:n:P:p:S:s:T:t:u:VW: flag $DAEMON_OPTS

Configuration example

sudo nano /etc/default/varnish

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,256m \
             -W epoll"

Varnish 5

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish5/script.deb.sh | sudo bash

Varnish modules

#!/bin/bash
# UBUNTU DEPENDENCIES
sudo apt-get install -y automake autotools-dev libedit-dev libjemalloc-dev libncurses-dev libpcre3-dev libtool pkg-config python-docutils python-sphinx varnish-dev unzip

# INSTALL VARNISH MODULES
# https://github.com/varnish/varnish-modules
cd $HOME
wget https://download.varnish-software.com/varnish-modules/varnish-modules-0.10.2.tar.gz
tar xvzf varnish-modules-0.10.2.tar.gz
rm varnish-modules-0.10.2.tar.gz
cd varnish-modules-0.10.2
sh configure
make
make check
sudo make install

cd $HOME
rm -rf varnish-modules-0.10.2

# INSTALL QUERYSTRING MODULE FOR VARNISH 5
# https://github.com/Dridi/libvmod-querystring/tree/master
wget https://github.com/Dridi/libvmod-querystring/archive/master.zip
unzip master.zip -d .
rm master.zip
cd libvmod-querystring-master
sh configure --with-rst2man=:
make
make check
sudo make install

cd $HOME
rm -rf libvmod-querystring-master


# INSTALL QUERYSTRING MODULE FOR VARNISH 4
# https://github.com/Dridi/libvmod-querystring/tree/4.0
wget https://github.com/Dridi/libvmod-querystring/archive/4.0.zip
unzip 4.0.zip -d .
rm 4.0.zip
cd libvmod-querystring-4.0
sh autogen.sh
sh configure
make check
sudo make install

cd $HOME
rm -rf libvmod-querystring-4.0

# INSTALL BOLTSORT MODULE 4 - 5
# https://github.com/vimeo/libvmod-boltsort/tree/master
wget https://github.com/vimeo/libvmod-boltsort/archive/master.zip
unzip master.zip -d .
rm master.zip
cd libvmod-boltsort-master
sh autogen.sh
sh configure
make
make check
sudo make install

cd $HOME
rm -rf libvmod-boltsort-master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment