/etc/yum.repos.d/varnish.repo [varnishcache_varnish41] name=varnishcache_varnish41 baseurl=https://packagecloud.io/varnishcache/varnish41/el/6/$basearch repo_gpgcheck=1 gpgcheck=0 enabled=1 gpgkey=https://packagecloud.io/varnishcache/varnish41/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 OK, ready then yum clean all yum install varnish Check the version: # /usr/sbin/varnishd -V varnishd (varnish-4.1.8 revision d266ac5c6) here is my varnish default configuration /etc/sysconfig/varnish NFILES=131072 MEMLOCK=2000 NPROCS=”unlimited” […]
varnishadm ban
When cleaning the cache on varnish 3.0 there is a way to only ban the specific host. The command is: varnishadm -T localhost:1234 ban req.http.host ~ “site.com” && req.url ~ “/path”
check_backend.sh
Another bash script to monitor if there were any failed connections to the backend’s. It is a simple aproach using the command: varnishstat -1 -f backend_fail Then it puts the output on a tmp file and next time it runs […]
varnish performance analyser
A script to get the time of each requests and verify how long it took. Example req | [0,1[ | [1,2] | ]2,3] | ]3,4] | ]4,5] | <=10 | <=15 | >15 | min | […]
Script to purge varnish cache
There is a easy way to allow developers to stop bugging us the system adminsitror, “clean the cache”. Just setup this php page on a apache server and they can do it themselves. Tested on Varnish 2.X using syntax: curl […]
check_conntrack_unreplied
Our front end varnish servers expierence a lot of traffic and we currently must have a iptables NAT that routes from port 80 to port 81, where the varnish daemon listen to traffic. Doing this we end up using the […]
How varnish can identify mobile users
How varnish can identify mobile users In this example it basically finds out via regex on the user-agent tag if the user is mobile if so it redirect to a mobile site. sub identify_device { unset req.http.hash-input; set req.http.X-Device = […]