{"id":1572,"date":"2020-09-07T04:38:24","date_gmt":"2020-09-07T04:38:24","guid":{"rendered":"http:\/\/ubiq.co\/tech-blog\/?p=1572"},"modified":"2025-09-30T04:22:51","modified_gmt":"2025-09-30T04:22:51","slug":"install-varnish-cache-nginx-centos","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/","title":{"rendered":"How To Install Varnish Cache for NGINX in Centos"},"content":{"rendered":"<p>Varnish is a high-performance cache module that improves website speed and performance with caching. Here&#8217;s how to install varnish cache for NGINX server in CentOS, Redhat, Fedora Linux.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#How_To_Install_Varnish_Cache_for_NGINX_in_Centos\" >How To Install Varnish Cache for NGINX in Centos<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#1_Install_NGINX_on_CentOS\" >1. Install NGINX on CentOS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#2_Add_EPEL_Repository\" >2. Add EPEL Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#3_Install_dependencies\" >3. Install dependencies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#4_Add_Varnish_Cache_Repository\" >4. Add Varnish Cache Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#5_Install_Varnish_Cache\" >5. Install Varnish Cache<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#6_Configure_NGINX_to_Work_with_Varnish\" >6. Configure NGINX to Work with Varnish<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#7_Configure_Varnish_to_Work_with_NGINX\" >7. Configure Varnish to Work with NGINX<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#8_Setup_NGINX_as_backend_proxy\" >8. Setup NGINX as backend proxy<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#9_Restart_NGINX_and_Varnish_Cache\" >9. Restart NGINX and Varnish Cache<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#10_Test_Varnish_Cache_with_NGINX\" >10. Test Varnish Cache with NGINX<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_To_Install_Varnish_Cache_for_NGINX_in_Centos\"><\/span>How To Install Varnish Cache for NGINX in Centos<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Here are the steps to install varnish cache for NGINX server in CentOS, Redhat, Fedora linux.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"1_Install_NGINX_on_CentOS\"><\/span>1. Install NGINX on CentOS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you have already installed NGINX in CentOS, skip to the next step. Else open terminal and run the following commands to install NGINX.<\/p>\n<pre># yum install nginx\n<\/pre>\n<p>If you get a yes\/no prompt, enter &#8216;y&#8217; or &#8216;Y&#8217; to complete installation.<\/p>\n<p>Run the following command to start NGINX and enable it to autostart during system boot.<\/p>\n<pre># systemctl start nginx\n# systemctl enable nginx\n<\/pre>\n<p>Bonus Read : <a href=\"http:\/\/ubiq.co\/tech-blog\/nginx-ssl-configuration-step-step-details\/\">NGINX SSL Configuration Step by Step<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"2_Add_EPEL_Repository\"><\/span>2. Add EPEL Repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Some of Varnish cache dependencies require EPEL repository setup. Run the following command to install it.<\/p>\n<pre># yum install -y epel-release\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"3_Install_dependencies\"><\/span>3. Install dependencies<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Install the dependencies required for varnish cache.<\/p>\n<pre># yum install pygpgme yum-utils\n<\/pre>\n<p>Bonus Read : <a href=\"http:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\">How to Prevent Image Hotlinking in NGINX<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"4_Add_Varnish_Cache_Repository\"><\/span>4. Add Varnish Cache Repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Open the following file<\/p>\n<pre># vi \/etc\/yum.repos.d\/varnishcache_varnish5.repo\n<\/pre>\n<p>and copy paste the following code in it. Make sure you replace <strong>\/el\/7<\/strong> with your Linux version. In this case, we have used 7 for CentOS 7.<\/p>\n<pre>[varnishcache_varnish5]\nname=varnishcache_varnish5\nbaseurl=https:\/\/packagecloud.io\/varnishcache\/varnish5\/<strong>el<\/strong>\/<strong>7<\/strong>\/$basearch\nrepo_gpgcheck=1\ngpgcheck=0\nenabled=1\ngpgkey=https:\/\/packagecloud.io\/varnishcache\/varnish5\/gpgkey\nsslverify=1\nsslcacert=\/etc\/pki\/tls\/certs\/ca-bundle.crt\nmetadata_expire=300\n\n[varnishcache_varnish5-source]\nname=varnishcache_varnish5-source\nbaseurl=https:\/\/packagecloud.io\/varnishcache\/varnish5\/<strong>el<\/strong>\/<strong>7<\/strong>\/SRPMS\nrepo_gpgcheck=1\ngpgcheck=0\nenabled=1\ngpgkey=https:\/\/packagecloud.io\/varnishcache\/varnish5\/gpgkey\nsslverify=1\nsslcacert=\/etc\/pki\/tls\/certs\/ca-bundle.crt\nmetadata_expire=300<\/pre>\n<p>Save and close the file.<\/p>\n<p>Bonus Read : <a href=\"http:\/\/ubiq.co\/tech-blog\/harden-nginx-server\/\">How to harden NGINX Server<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"5_Install_Varnish_Cache\"><\/span>5. Install Varnish Cache<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Run the following command to install varnish cache in CentOS. Enter y or Y or yes in case you see any prompts.<\/p>\n<pre># yum -q makecache -y --disablerepo='*' --enablerepo='varnishcache_varnish5'\n# yum install varnish\n<\/pre>\n<p>After installation, you will find the main executable at \/usr\/bin\/varnishd and configuration files at \/etc\/varnish\/. Here are the other key files you need to note.<\/p>\n<ul>\n<li><strong>\/etc\/varnish\/varnish.params<\/strong> \u2013 varnish environment configuration file.<\/li>\n<li><strong>\/etc\/varnish\/default.vcl<\/strong> \u2013 main varnish configuration file, written using vanish configuration language(VCL).<\/li>\n<li><strong>\/etc\/varnish\/secret<\/strong> \u2013 varnish secret file<\/li>\n<\/ul>\n<p>You can get the above information by running the following command in terminal.<\/p>\n<pre># rpm -qi varnish\n<\/pre>\n<p>Verify installation by running the following commands<\/p>\n<pre># which varnishd\n# varnishd -V\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"6_Configure_NGINX_to_Work_with_Varnish\"><\/span>6. Configure NGINX to Work with Varnish<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>By default, NGINX listens to port 80. In this step, we will make Varnish listen to port 80 and NGINX listen to port 8080 so that NGINX is running behind Varnish cache.<\/p>\n<p>Open NGINX configuration file at \/etc\/nginx\/nginx.conf<\/p>\n<pre># vi \/etc\/nginx\/nginx.conf\n<\/pre>\n<p>If you have configured separate <a href=\"http:\/\/ubiq.co\/tech-blog\/setup-nginx-virtual-hosts-ubuntu\/\">virtual hosts<\/a> for your website (e.g www.website.com), such as \/etc\/nginx\/sites-enabled\/website.conf then open its configuration with the following command<\/p>\n<pre># vi\u00a0\/etc\/nginx\/sites-enabled\/website.conf<\/pre>\n<p>Look for the line in <em>server<\/em> block<\/p>\n<pre>listen 80;\n<\/pre>\n<p>and change it to<\/p>\n<pre>listen 8080;\n<\/pre>\n<p>Here&#8217;s an example<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1582 aligncenter\" src=\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/configure-nginx-listening-port.png?resize=722%2C354\" alt=\"configure nginx listening port\" width=\"722\" height=\"354\" \/><\/p>\n<p>Please note, if you make changes to a virtual host configuration file, only that website will be configured to work with Varnish cache.<\/p>\n<p>If you have <a href=\"https:\/\/ubiq.co\/tech-blog\/change-nginx-port-number-ubuntu\/\">changed NGINX port number<\/a>, then you need to modify the above configuration accordingly.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"7_Configure_Varnish_to_Work_with_NGINX\"><\/span>7. Configure Varnish to Work with NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>By default, Varnish listens to port 6081. We need to make it listen to port 80. Open varnish configuration file.<\/p>\n<pre># vi \/etc\/varnish\/varnish.params\n<\/pre>\n<p>Update VARNISH_LISTEN_PORT from 6081 to 80 as shown below.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1583 aligncenter\" src=\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/Configure-Varnish-Cache.png?resize=730%2C381\" alt=\"Configure Varnish Cache\" width=\"730\" height=\"381\" srcset=\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/Configure-Varnish-Cache.png?w=732&amp;ssl=1 732w, https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/Configure-Varnish-Cache.png?resize=730%2C382&amp;ssl=1 730w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"8_Setup_NGINX_as_backend_proxy\"><\/span>8. Setup NGINX as backend proxy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Open \/etc\/varnish\/default.vcl file to configure NGINX as backend proxy.<\/p>\n<pre># vi \/etc\/varnish\/default.vcl\n<\/pre>\n<p>Update the .port value in backend block to have 8080 value. This will point varnish cache to NGINX.<\/p>\n<pre>backend default {\n     .host = \"127.0.0.1\";\n     .port = \"<strong>8080<\/strong>\";\n}\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"9_Restart_NGINX_and_Varnish_Cache\"><\/span>9. Restart NGINX and Varnish Cache<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Restart NGINX and Varnish cache to apply changes<\/p>\n<pre># systemctl restart nginx\n# systemctl start varnish\n# systemctl enable varnish\n# systemctl status varnish\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"10_Test_Varnish_Cache_with_NGINX\"><\/span>10. Test Varnish Cache with NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Run the curl command to send a request to your server.<\/p>\n<pre># curl -I http:\/\/<strong>your_server_or_ip<\/strong>\n<\/pre>\n<p>You will see <em>via : 1.1 varnish (Varnish \/5.2)<\/em> header<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1584 aligncenter\" src=\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/Test-Varnish-Cache-on-Nginx.png?resize=522%2C287\" alt=\"Test Varnish Cache on Nginx\" width=\"522\" height=\"287\" \/><\/p>\n<p>Hopefully, now you can install and setup varnish cache for NGINX on CentOS, Redhat, Fedora Linux systems.<\/p>\n<p><a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>\u00a0makes it easy to visualize data in minutes, and monitor in real-time dashboards.\u00a0<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a> today!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Varnish Cache is cache module for improving website speed and performance with caching. Here&#8217;s how to install varnish cache for NGINX in CentOS, Redhat, Fedora.<\/p>\n","protected":false},"author":1,"featured_media":1578,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[137,136],"class_list":["post-1572","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nginx","tag-cache","tag-varnish"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Install Varnish Cache for NGINX in Centos - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Varnish Cache is cache module for improving website speed and performance with caching. Here&#039;s how to install varnish cache for NGINX in CentOS, Redhat, Fedora.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Install Varnish Cache for NGINX in Centos - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Varnish Cache is cache module for improving website speed and performance with caching. Here&#039;s how to install varnish cache for NGINX in CentOS, Redhat, Fedora.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-07T04:38:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-30T04:22:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/install-varnish-cache-nginx.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How To Install Varnish Cache for NGINX in Centos\",\"datePublished\":\"2020-09-07T04:38:24+00:00\",\"dateModified\":\"2025-09-30T04:22:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/\"},\"wordCount\":574,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1\",\"keywords\":[\"cache\",\"varnish\"],\"articleSection\":[\"Nginx\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/\",\"name\":\"How To Install Varnish Cache for NGINX in Centos - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1\",\"datePublished\":\"2020-09-07T04:38:24+00:00\",\"dateModified\":\"2025-09-30T04:22:51+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Varnish Cache is cache module for improving website speed and performance with caching. Here's how to install varnish cache for NGINX in CentOS, Redhat, Fedora.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1\",\"width\":1600,\"height\":900,\"caption\":\"install varnish cache for nginx\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/install-varnish-cache-nginx-centos\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Install Varnish Cache for NGINX in Centos\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Install Varnish Cache for NGINX in Centos - Ubiq BI","description":"Varnish Cache is cache module for improving website speed and performance with caching. Here's how to install varnish cache for NGINX in CentOS, Redhat, Fedora.","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:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/","og_locale":"en_US","og_type":"article","og_title":"How To Install Varnish Cache for NGINX in Centos - Ubiq BI","og_description":"Varnish Cache is cache module for improving website speed and performance with caching. Here's how to install varnish cache for NGINX in CentOS, Redhat, Fedora.","og_url":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-09-07T04:38:24+00:00","article_modified_time":"2025-09-30T04:22:51+00:00","og_image":[{"width":1600,"height":900,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/install-varnish-cache-nginx.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How To Install Varnish Cache for NGINX in Centos","datePublished":"2020-09-07T04:38:24+00:00","dateModified":"2025-09-30T04:22:51+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/"},"wordCount":574,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1","keywords":["cache","varnish"],"articleSection":["Nginx"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/","url":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/","name":"How To Install Varnish Cache for NGINX in Centos - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1","datePublished":"2020-09-07T04:38:24+00:00","dateModified":"2025-09-30T04:22:51+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Varnish Cache is cache module for improving website speed and performance with caching. Here's how to install varnish cache for NGINX in CentOS, Redhat, Fedora.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1","width":1600,"height":900,"caption":"install varnish cache for nginx"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/install-varnish-cache-nginx-centos\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How To Install Varnish Cache for NGINX in Centos"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/install-varnish-cache-nginx.jpg?fit=1600%2C900&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-pm","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=1572"}],"version-history":[{"count":10,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1572\/revisions"}],"predecessor-version":[{"id":9668,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1572\/revisions\/9668"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/1578"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=1572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=1572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=1572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}