Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code snippets from presentation "Varnish Configuration Step by Step"
------ Slide 8 ------
sudo su -
yum install -y gcc make pkgconfig pcre-devel ncurses-devel
cd /usr/src
wget -O - | tar xz
cd varnish-3.0.2
make && make install
------ Slide 10 ------
varnishadm -T localhost:2000 ban.url "^/$"
varnishadm -T localhost:2000 ban.url "^/.*"
sudo /usr/local/sbin/varnishd -s malloc,130M -u nobody -g nobody -p cli_timeout=30 -p thread_pool_add_delay=2 -p thread_pool_min=400 -p thread_pool_max=4000 -p session_linger=100 -f /etc/varnish/<your_config>.vcl -T -a
------ Slide 12 ------
# If not yet installed: sudo yum install -y make
wget -O - | tar xz
cd <comotion-security-dir>/vcl/
sudo make
cd ..
sudo ln -s $PWD/vcl/ /etc/varnish/security
include "/etc/varnish/security/main.vcl";
------ Slide 15 ------
sudo rpm -Uvh
sudo yum install -y newrelic-sysmond
sudo nrsysmond-config --set license_key=<your_license_key>
sudo /etc/init.d/newrelic-sysmond start
------ Slide 19 ------
sudo su -
yum install -y munin-node munin
cd /usr/share/munin/plugins/
chmod a+x /usr/share/munin/plugins/varnish_*
ln -s /usr/share/munin/plugins/varnish_* /etc/munin/plugins/
------ Slide 20 ------
user root
# Uncomment to set network traffic warning at 400K
# [if_*]
# env.warning 400000 mail -s "Munin notification" warning critical
------ Slide 26 ------
00 08 * * Mon root /etc/varnish/
sudo yum install -y mutt
sudo service crond restart
------ Slide 28 ------
sudo yum install -y lighttpd
server.port = 8081
server.document-root = server_root + "/html"
$HTTP["remoteip"] !~ "" {
url.access-deny = ( "" )
sudo service lighttpd start
------ Slide 31 ------
sudo su -
mkdir -p /package
cd /package
tar zxpf daemontools-0.76.tar.gz
rm -f daemontools-0.76.tar.gz
cd admin/daemontools-0.76
sed -i '/extern int errno/{s/^/\/* /;s/$/ *\//;G;s/$/#include <errno.h>/;}' src/error.h
mkdir /var/service
mkdir -m 1755 /var/service/varnish
------ Slide 33 ------
mkdir -m 755 /var/service/varnish/log
cd /var/service/varnish/log
mv service-any-log-run run
chmod 755 run
ln -s /var/service/varnish /service/varnish
svstat /service/varnish /service/varnish/log
------ Slide 34 ------
start on runlevel [12345]
stop on runlevel [^12345]
exec /command/svscanboot

This comment has been minimized.

Copy link
Owner Author

kimlindholm commented Feb 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.