InMotion Hosting Support Center

Note: that you will need root access in order to use these directions. InMotion Hosting allows root access on VPS and Dedicated Hosting plans.

In this tutorial:

This guide will briefly go over how to install and configure Varnish Caching. Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture. Please keep in mind that this is a fairly advanced section and does require you to use root access to perform any actions described. Also know that unless you pay for a plugin to do so you can not control varnish from the WHM interface.


This will get Apache ready which should be done prior to the installation to avoid port conflicts.

  1. Log into your servers command line interface as the root user.
  2. Edit the following file.
    vim /var/cpanel/cpanel.config
  3. Look for the line "apache_port" and change it to the following then save the file.
  4. Run this command to update the settings.
    /usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings


This section will show you how to install Varnish 3 onto your dedicated server.

  1. Check what version of CentOS you are running by entering the following command.
    cat /etc/centos-release
    CentOS release 6.7 (Final)
  2. Run the following commands to add the Varnish repositories to your server (Please use the correct command for the current version you are running.).
    CentOS 6 - rpm --nosignature -i

    CentOS 5 - rpm --nosignature -i
  3. Install Varnish via yum.
    yum install varnish


  1. Edit the following file.
    vim /etc/sysconfig/varnish
  2. Add the following lines to the bottom of the file (After the # DAEMON_OPTS="" line).
    DAEMON_OPTS="-a :80 \
    -T localhost:6082 \
    -b localhost:8081 \
    -u varnish -g varnish \
    -s file,/var/lib/varnish/varnish_storage.bin,2G"
  3. Save the file.
  4. Restart the following services for the changes to take affect.
    service varnish restart
    service httpd restart

This configuration does the following:

  1. Listen on all IP addresses on port 80
  2. Set the administrative interface on port 6082 (the default)
  3. Forward requests to localhost on port 8081 (Apache server we changed earlier)
  4. Set the user/group for child processes to varnish:varnish
  5. Use the file storage mechanism at /var/lib/varnish/varnish_storage.bin and use only 2GB for the file.
Was this article helpful?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

n/a Points
2017-02-07 6:41 pm

Installing Varnish 4.1 on CentOS 7 relusts with dependency issue,

Can you provide any suggestions?


--> Running transaction check---> Package varnish.x86_64 0:4.1.4-1.el7 will be installed--> Processing Dependency: jemalloc for package: varnish-4.1.4-1.el7.x86_64--> Processing Dependency: for package: varnish-4.1.4-1.el7.x86_64--> Finished Dependency ResolutionError: Package: varnish-4.1.4-1.el7.x86_64 (varnish-4.1)           Requires: jemallocError: Package: varnish-4.1.4-1.el7.x86_64 (varnish-4.1)           Requires: You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

n/a Points
2016-12-30 11:47 am


Isn't varnish 3.x at end-of-life? Are there updated instructions for Varnish 4?


43,761 Points
2016-12-30 3:26 pm
You are correct, Varnish 3 has ended its life cycle. We do not currently have other instructions for installign Varnish 4. We will test these instructions with the new version and see if new instructions need to be rewritten.
n/a Points
2016-12-13 1:43 pm

Are there any potential issues or complications to doing this? (Wordpress complications, server reboots, etc...?) I have several mission critical sites on my server that I cannot afford to drop but could use the performance increase.

Are there options to have this done by managed hosting after hours?

10,824 Points
2016-12-13 2:11 pm
Yes, in an ideal situation, any down time would be minimal or non-existent. The restarts required are very quick. I suggest checking with Managed Hosting at your convenience to see if they can do this for you.
n/a Points
2016-11-22 12:40 pm

As Varnish uses a lot of memory for the VPS1000, is there a web application accelerator recommended by IMH or perhaps a list we can refer to that would be compatible to VPS1000?

Thanks in advance!


10,824 Points
2016-11-22 2:02 pm
We don't have a dedicated list of web accelerators, but there are a few out there that are well supported, and there are no immediate impediments you would have if you are using root access to your VPS.
n/a Points
2016-08-06 5:17 am


I have zend opcache installed on my VPS. Can I installed also varnish cache with it. I am using inmotionhosting VPS 1000. 

43,761 Points
2016-08-08 2:25 pm
While you can, you likely should not do this on a VPS1000 due to the memory requirements for Varnish. It will likely slow your site further instead of making it faster.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

9 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!