Step 1. Install varnish
sudo apt-get install varnish
Step 2. After successful installation of varnish edit /etc/varnish/default.vcl file
backend default {
.host = "127.0.0.1";
.port = "8080";
}
Step 3.Now edit the varnish configuration file /etc/default/varnish file
# Should we start varnishd at boot? Set to "yes" to enable.
START=yes
## Alternative 2, Configuration with VCL
#
# Listen on port 6081, administration on localhost:6082, and forward to
# one content server selected by the vcl file, based on the request. Use a 1GB
# fixed-size cache file.
#
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,128M"
Step 4. Configure your Apache according to varnish
a. edit /etc/apache/ports.conf
NameVirtualHost *:8080
Listen 8080
b. edit /etc/apache2/sites-available/default
NameVirtualHost *:8080
Listen 8080
-if you don't have above setting your file, leave as it is only modify the following line in this file
c. edit vhost file(Optional)
ServerName umarani.com
Step 5. Restart Apache and varnish.
a. Restart apache.
sudo /etc/init.d/apache2 restart OR
sudo service apache2 restart
b. Start varnish.
sudo /etc/init.d/varnish start OR
sudo service varnish start
You can check varnish log by "varnishlog" command
Also make sure your ports are listening properly by this command
netstat -anp --tcp --udp | grep LISTEN
Comments
Submitted by Vineet (not verified) on Mon, 10/03/2011 - 15:34 Permalink
What is Varnish
What is Varnish and how does it help me
Submitted by steve442 (not verified) on Sun, 11/11/2012 - 00:54 Permalink
thanks for this
I essentially want to say I 'm beginner to weblog and ultra reverred the website . Often times Im being after to bookmark your website . You definitely have olympian well crafted articles. Bless the application for sharing with us web site page.