Skip to content

Instantly share code, notes, and snippets.

@nghuuphuoc
Last active December 26, 2017 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nghuuphuoc/7819928 to your computer and use it in GitHub Desktop.
Save nghuuphuoc/7819928 to your computer and use it in GitHub Desktop.
Install Vanish on Centos 6
// Add repos
$ rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm
$ yum install varnish
$ chkconfig --level 345 varnish on
// Start Vanish
$ /etc/init.d/varnish start
// Varnish config file
// /etc/sysconfig/varnish
// Default VCL file
// /etc/varnish/default.vcl
// Config Varnish in front of Nginx
$ nano /etc/sysconfig/varnish
VARNISH_LISTEN_PORT=80
$ nano /etc/varnish/default.vcl
backend default {
.host = "127.0.0.1";
.port = "8001";
}
// Set Nginx listen on the port 8001
server {
listen 8001;
}
// Restart Nginx and Vanish
$ service nginx restart
$ /etc/init.d/varnish restart
// Commands
$ varnishstat
$ varnishhist
$ varnishlog
$ varnishadm
$ varnishtop
// Show files that are being served
$ varnishtop -i txurl
// Clear all cache
$ varnishadm "ban req.url ~ /"
or
$ varnishadm "ban req.http.host ~ www.mydomain.com"
// Purge only CSS
$ varnishadm "ban req.http.host ~ www.mydomain.com && req.url ~ .css"
@mazenelmasry
Copy link

curl: (22) The requested URL returned error: 410 repo

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