{"id":3853,"date":"2016-05-03T13:40:23","date_gmt":"2016-05-03T17:40:23","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2016\/05\/03\/installing-and-configuring-varnish\/"},"modified":"2024-04-17T12:52:57","modified_gmt":"2024-04-17T16:52:57","slug":"installing-and-configuring-varnish","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/","title":{"rendered":"Installing and Configuring Varnish 3"},"content":{"rendered":"\n<p>This guide will briefly go over how to install and configure Varnish Caching on your webhosting account. 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 &#8211; 1000x, depending on your architecture.<\/p>\n\n\n\n<p>Please keep in mind that this is a fairly advanced section and requires you to use <a href=\"\/support\/amp\/obtain-root-access\/\">root access<\/a> 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.<\/p>\n\n\n\n<div class=\"alert alert-warning\" role=\"alert\"><strong>Note:<\/strong> that you will need <a href=\"\/support\/amp\/obtain-root-access\/\">root access<\/a> in order to use these directions. InMotion Hosting allows root access on <a href=\"https:\/\/www.inmotionhosting.com\/vps-hosting\" target=\"_blank\" rel=\"noopener noreferrer\">VPS<\/a> and <a href=\"https:\/\/www.inmotionhosting.com\/dedicated-servers\" target=\"_blank\" rel=\"noopener noreferrer\">Dedicated Hosting<\/a> plans.<a name=\"preparation\"><\/a><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#preparation\">Preparing to Install Varnish<\/a><\/li>\n\n\n\n<li><a href=\"#installation\">Installing Varnish<\/a><\/li>\n\n\n\n<li><a href=\"#configuration\">Configuring Varnish<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"preparation\">Preparing to Install Varnish<\/h2>\n\n\n\n<p>This will get Apache ready which should be done prior to the installation to avoid port conflicts.<\/p>\n\n\n\n<ol class=\"article_list wp-block-list\">\n<li>Log into your servers command line interface as the <a href=\"\/support\/amp\/obtain-root-access\/\">root user<\/a>.<span style=\"color: initial;\">&nbsp;<\/span> <\/li>\n\n\n\n<li>Edit the following file. <pre>vim \/var\/cpanel\/cpanel.config<\/pre><\/li>\n\n\n\n<li>Look for the line &#8220;<strong>apache_port<\/strong>&#8221; and change it to the following then save the file. <pre>apache_port=0.0.0.0:8081<\/pre><\/li>\n\n\n\n<li>Run this command to update the settings. <pre>\/usr\/local\/cpanel\/whostmgr\/bin\/whostmgr2 --updatetweaksettings<\/pre><a name=\"installation\"><\/a><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installation\">Installing Varnish<\/h2>\n\n\n\n<p>This section will show you how to install Varnish 3 onto your dedicated server.<\/p>\n\n\n\n<ol class=\"article_list wp-block-list\">\n<li>Check what version of CentOS you are running by entering the following command. <pre>cat \/etc\/centos-release<\/pre><\/li>\n\n\n\n<li>Run the following commands to <a href=\"\/support\/server\/linux\/add-repositories-centos\/\">add the Varnish repositories to your server<\/a> (Please use the correct command for the current version you are running.). <br><strong>CentOS 6 &#8211;<\/strong><br><pre>rpm --nosignature -i https:\/\/repo.varnish-cache.org\/redhat\/varnish-3.0\/el6\/noarch\/varnish-release\/varnish-release-3.0-1.el6.noarch.rpm<\/pre> <strong>CentOS 5 &#8211;<\/strong><br><pre>rpm --nosignature -i https:\/\/repo.varnish-cache.org\/redhat\/varnish-3.0\/el5\/noarch\/varnish-release\/varnish-release-3.0-1.el5.centos.noarch.rpm<\/pre><\/li>\n\n\n\n<li>Install Varnish via yum. <pre>yum install varnish<\/pre><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuration\">Configuring Varnish<\/h2>\n\n\n\n<p>Now that you have Varnish installed, we&#8217;ll show you how to set it up. This configuration does the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Listen on all IP addresses on port 80<\/li>\n\n\n\n<li>Set the administrative interface on port 6082 (the default)<\/li>\n\n\n\n<li>Forward requests to localhost on port 8081 (Apache server we changed earlier)<\/li>\n\n\n\n<li>Set the user\/group for child processes to varnish:varnish<\/li>\n\n\n\n<li>Use the file storage mechanism at \/var\/lib\/varnish\/varnish_storage.bin and use only 2GB for the file.<\/li>\n<\/ul>\n\n\n\n<ol class=\"article_list wp-block-list\">\n<li>Edit the following file. <pre>vim \/etc\/sysconfig\/varnish<\/pre><div style=\"clear: both;\"><\/div><\/li>\n\n\n\n<li>Add the following lines to the bottom of the file (After the # DAEMON_OPTS=&#8221;&#8221; line). <pre>DAEMON_OPTS=\"-a :80 \\<br>-T localhost:6082 \\<br>-b localhost:8081 \\<br>-u varnish -g varnish \\<br>-s file,\/var\/lib\/varnish\/varnish_storage.bin,2G\"<\/pre><div style=\"clear: both;\"><\/div><\/li>\n\n\n\n<li>Save the file.<span style=\"color: initial;\">&nbsp;<\/span> <\/li>\n\n\n\n<li>Restart the following services for the changes to take affect. <pre>service varnish restart<\/pre><br><pre>service httpd restart<\/pre><div style=\"clear: both;\"><\/div><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This guide will briefly go over how to install and configure Varnish Caching on your webhosting account. 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<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4307],"tags":[],"class_list":["post-3853","post","type-post","status-publish","format-standard","hentry","category-ssh"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Installing and Configuring Varnish 3 | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"This guide will briefly go over how to install and configure Varnish Caching on your webhosting account.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Installing and Configuring Varnish 3 | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"This guide will briefly go over how to install and configure Varnish Caching on your webhosting account.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-03T17:40:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-17T16:52:57+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"Installing and Configuring Varnish 3\",\"datePublished\":\"2016-05-03T17:40:23+00:00\",\"dateModified\":\"2024-04-17T16:52:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\"},\"wordCount\":375,\"commentCount\":11,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"SSH and Root Access\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\",\"name\":\"Installing and Configuring Varnish 3 | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2016-05-03T17:40:23+00:00\",\"dateModified\":\"2024-04-17T16:52:57+00:00\",\"description\":\"This guide will briefly go over how to install and configure Varnish Caching on your webhosting account.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Installing and Configuring Varnish 3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Installing and Configuring Varnish 3 | InMotion Hosting","description":"This guide will briefly go over how to install and configure Varnish Caching on your webhosting account.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/","og_locale":"en_US","og_type":"article","og_title":"Installing and Configuring Varnish 3 | InMotion Hosting","og_description":"This guide will briefly go over how to install and configure Varnish Caching on your webhosting account.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2016-05-03T17:40:23+00:00","article_modified_time":"2024-04-17T16:52:57+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"Installing and Configuring Varnish 3","datePublished":"2016-05-03T17:40:23+00:00","dateModified":"2024-04-17T16:52:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/"},"wordCount":375,"commentCount":11,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["SSH and Root Access"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/","name":"Installing and Configuring Varnish 3 | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2016-05-03T17:40:23+00:00","dateModified":"2024-04-17T16:52:57+00:00","description":"This guide will briefly go over how to install and configure Varnish Caching on your webhosting account.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/installing-and-configuring-varnish\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Installing and Configuring Varnish 3"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4307,"name":"SSH and Root Access","slug":"ssh","link":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3853"}],"version-history":[{"count":7,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3853\/revisions"}],"predecessor-version":[{"id":127592,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3853\/revisions\/127592"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}