How to Install ‘Varnish’ (HTTP Accelerator) and Perform Load Testing Using Apache Benchmark

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Gabriel Cánepa

Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

37 Responses

  1. sohail says:

    I have installed varnish several times but it is not working. when I use curl -I localhost. It shows 403 error at the start.

    Kindly help me in resolving this issue

  2. Ravi Saive says:

    I’ve checked the configuration, seems correctly configured, may I know while browsing site, are you getting any error message. If possible can you send me a link to that error page or screen grab for better understanding..

  3. Mike says:


    Good article. We are running varnish on redhat using RPM packages. Now we have a been tasked with installing additional VMods to extend the functionality of varnish. From what I have read this morning these VMods are compiled using the varnish code base ?

    Is there an alternate method for installing VMods into a varnish server that is managed with RPMs ? A link to a page with instructions would be super !


  4. vyas says:

    default varnish starts on port 6081. so first of all you can check the status of port via telnet.

    to test the varnish whether it is caching or not. please follow below steps.

    GET -Used http://localhost:6081/

    you will get below response including varnish in last line

    GET http://localhost:6081/
    User-Agent: lwp-request/2.07

    200 OK
    Connection: close
    Date: Wed, 05 Mar 2014 12:16:09 GMT
    Via: 1.1 varnish
    Accept-Ranges: bytes
    Age: 94
    ETag: “7a857f-1c-fa3243c0”
    Server: Apache/2.2.3 (Red Hat)
    Content-Length: 28
    Content-Type: text/html; charset=UTF-8
    Last-Modified: Tue, 25 Sep 2012 09:03:19 GMT
    Client-Date: Wed, 05 Mar 2014 12:16:09 GMT
    Client-Response-Num: 1
    X-Varnish: 1951550557 1951550551

    first our request will hit to 6081 and internally connect to 80 as per the configuration /etc/varnish/default.vcl

    You can also install varnish on 80 and apache on another port

  5. Thomas says:

    I followed the instructions and it does not say that varnish is running on my site. Not sure what I missed.

  6. aarif says:


    I have varnish running but I am confused regarding AGE. As I can see when you checked if you varnish was running or not, it should “AGE 0”. I have the same problem, it shows me “age 0”.

    I would like to increase my age, I don’t know if its feasible to increase age or not.

    I have seen some other sites which “age” changing frequently.


  7. Agus says:

    thanks for great articles
    i have install but i didn’t see varnish is working on my server

    [[email protected] download]# curl -I
    HTTP/1.1 301 Moved Permanently
    Date: Thu, 23 Jan 2014 04:42:31 GMT
    Server: Apache
    Cache-Control: max-age=86400
    Expires: Fri, 24 Jan 2014 04:42:31 GMT
    Vary: Accept-Encoding
    Content-Type: text/html; charset=iso-8859-1

  8. Veli says:

    I have tried Varnish cache too. My website is still very slow. What could be problem here. I have apache2 server. I think Debian 3.2.46-1+deb7u1 x86_64

    Thanks for your help.

    [email protected]:~# curl -I
    HTTP/1.1 200 OK
    Server: nginx
    Date: Mon, 06 Jan 2014 17:43:09 GMT
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Set-Cookie: PHPSESSID=526d06842a6c6c4e484b7005062ac49f; path=/
    Set-Cookie: kpg_stop_spammers_time=1389030189; expires=Mon, 06-Jan-2014 17:44:09 GMT
    Set-Cookie: wfvt_3488105620=52caeb2d105ef; expires=Mon, 06-Jan-2014 18:13:09 GMT; path=/
    Set-Cookie: slimstat_tracking_code=790638id.ed22868133e1b023ab189d537d4dbeb5; expires=Thu, 06-Feb-2014 17:43:09 GMT; path=/
    X-Powered-By: PleskLin
    Vary: Accept-Encoding

    [email protected]:~#

  9. Mohsin says:


    Thanks for the information

    Is both Apache and Varnish will run on same port that 80, Do we need to change the port for Apache other than 80, So that Varnish will run on 80 and Apache run other than 80


  10. Bestretail says:

    Hello Team,

    Why when i try the command to verify the vanish on server. The connection status is ” Close ”

    [email protected] varnish]# curl -I
    HTTP/1.1 200 OK
    Date: Thu, 26 Dec 2013 03:25:04 GMT
    Server: Apache/2.2.15 (CentOS)
    Link: ; rel=shortlink
    Connection: close
    Content-Type: text/html; charset=UTF-8

    Kindly need advise.


Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.