{"id":710,"date":"2020-10-15T08:54:13","date_gmt":"2020-10-15T05:54:13","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=710"},"modified":"2024-02-06T11:31:15","modified_gmt":"2024-02-06T09:31:15","slug":"how-to-configure-a-cdn","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-configure-a-cdn\/","title":{"rendered":"How to configure a CDN?"},"content":{"rendered":"\n<p><span style=\"font-weight: 400;\">What happens, when a user enters your website&#8217;s domain name into the address bar and hits Enter?<\/span><\/p>\n<p><b>Table of Contents<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>What is a CDN? And why should I care?<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>The benefits of using a CDN<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>Is there a bandwidth limit?<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>Can I use it with multiple websites?<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>Do all hosting platforms support and benefit from a good CDN?<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>What CDN services should I use?<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>How much does it cost?<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>How to configure a CDN with ScalaHosting?<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>Testing<\/b><\/li>\n<li style=\"font-weight: 400;\"><b>Final takes<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The user&#8217;s computer fires off a request that embarks on a bit of a journey. It needs to pass through <\/span><b>a number of routers and network switches<\/b><span style=\"font-weight: 400;\"> in order to <\/span><b>reach the server hosting your website<\/b><span style=\"font-weight: 400;\">. We&#8217;re talking about physical devices spread across different countries and continents.<\/span> <span style=\"font-weight: 400;\">The higher the number of devices it needs to go through, the<\/span><b> longer it will take to reach your server<\/b><span style=\"font-weight: 400;\">. This is far from the end of the story, though.<\/span><\/p>\n<p><b>When the server receives the request<\/b><span style=\"font-weight: 400;\">, it must process it and send a response in the form of the web pages and media files. All that data needs to travel back to the user, passing through the same routers and switches as the request.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The information covers thousands of miles in mere seconds, and you can probably see that this is far from an ideal setup, especially if you&#8217;re trying to reach a global audience. This is <\/span><b>why Content Delivery Networks<\/b><i><span style=\"font-weight: 400;\"> (CDNs)<\/span><\/i><b> exist.<\/b><\/p>\n<h2><b>What is a CDN? And why should I care?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">The <\/span><b>physical distance between the end user and the server hosting<\/b><span style=\"font-weight: 400;\"> the content plays a major role in the website&#8217;s performance.<\/span><b> The internet is a global phenomenon<\/b><span style=\"font-weight: 400;\">, though, and ensuring that all users are geographically close to the web pages they&#8217;re trying to access is extremely difficult. It&#8217;s not impossible, though.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A Content Delivery Network (also known as Content Distribution Network or simply CDN) is a network of servers and data centers spread all around the world that store website data. A CDN isn&#8217;t s substitute <\/span><b>for a web host<\/b><span style=\"font-weight: 400;\">. Instead, it&#8217;s a way of ensuring that your website&#8217;s static content is stored in multiple locations and is loaded from the server that is closest to the user.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here&#8217;s a simple scenario that will show you <\/span><b>how a CDN works<\/b><span style=\"font-weight: 400;\">. You host a website in the US, and a user from Germany is trying to reach it. Normally, all the data packets would need to travel <\/span><b>between Germany and the US<\/b><span style=\"font-weight: 400;\"> if the website is to load. If you have a<\/span><b> CDN turned on, however, CSS files, JavaScript libraries, and images <\/b><span style=\"font-weight: 400;\">would be stored on <\/span><b>multiple locations all around the world<\/b><span style=\"font-weight: 400;\">, including on a server close to the user in Germany.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When they try to access the website,<\/span><b> the static data<\/b><span style=\"font-weight: 400;\"> will be loaded from the <\/span><b>CDN server <\/b><span style=\"font-weight: 400;\">(also known as an edge server) closest to their geographical location. Your web host server (or origin server) will only be responsible for handling the dynamic parts of your website. What are the benefits of all this?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The amount of information that needs to make the journey between the US and Germany is smaller, and as a result, the website loads much quicker.<\/span><\/p>\n<p>\u00a0<\/p>\n<h2><b>The benefits of using CDN<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">The performance benefit can be remarkable, but is it<\/span><b> the only advantage to using a CDN?<\/b><\/p>\n<p><b>Effectively,<\/b><span style=\"font-weight: 400;\"> some of your website&#8217;s files will be stored on multiple servers, and this might not seem like a very good idea at first. Some of you might think that this will make <\/span><b>managing the website more complicated<\/b><span style=\"font-weight: 400;\">. You might also think that the higher the number of servers, the greater the possibility of a hardware failure and downtime.<\/span><\/p>\n<p><b>We can safely say that these fears are unfounded<\/b><span style=\"font-weight: 400;\">. One of the great things about a content delivery network is that setting it up for your website is an almost entirely automated process. In most cases, after you <\/span><a href=\"https:\/\/www.scalahosting.com\/kb\/hosting\/dns\/\"><b>change your domain&#8217;s nameservers<\/b><\/a><span style=\"font-weight: 400;\">, the CDN provider does the rest of the work. And even if one of the edge servers fail for some reason, there are plenty of others to take up the slack and prevent downtime.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Meanwhile, the fact that the content is cached and served from <\/span><b>multiple different locations reduces the load on your origin server<\/b><span style=\"font-weight: 400;\"> and lowers bandwidth consumption. There are clear security benefits, as well.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">CDN providers are usually<\/span><b> big organizations<\/b><span style=\"font-weight: 400;\"> that know how to set up and configure their servers, which means that you don&#8217;t really need to worry about data loss. <\/span><b>Distributed Denial of Service <\/b><span style=\"font-weight: 400;\">(<\/span><b>DDoS<\/b><span style=\"font-weight: 400;\">) <\/span><b>attacks are less likely to bring your website down <\/b><span style=\"font-weight: 400;\">as well because properly configured CDNs effectively hide the origin server&#8217;s IP address. Instead of flooding the web host with junk requests, the attackers will be hitting the edge servers that can block the malicious traffic and protect your website.<\/span><\/p>\n<p>\u00a0<\/p>\n<h2><b>Is there a bandwidth limit?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Some of the bandwidth that would normally be taken up by your web host will be handled by the CDN provider, and you might be wondering whether this will cost you anything. <\/span><b>Different providers have different terms of service<\/b><span style=\"font-weight: 400;\">, and there is no single answer to this question.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Some will track the amount of bandwidth you&#8217;re<\/span><b> using and will charge you accordingly<\/b><span style=\"font-weight: 400;\">. Others will g<\/span><b>ive you a monthly quota <\/b><span style=\"font-weight: 400;\">and will charge you extra money if you exceed it. Others still have free plans that are suitable for most websites.<\/span><\/p>\n<h2><b>Can I use it with multiple websites?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">As you can see, there are plenty of advantages<\/span><b> to using a CDN<\/b><span style=\"font-weight: 400;\">, and if you have <\/span><b>multiple projects running at the same time,<\/b><span style=\"font-weight: 400;\"> you might be wondering whether it&#8217;s suitable for all of them. The short answer is yes.<\/span><\/p>\n<p><b>A CDN can be used to improve the performance and security of any website,<\/b><span style=\"font-weight: 400;\"> though it must be said that for some, the benefits will be much more visible. Websites that have a lot of <\/span><b>images, video, and audio assets<\/b><span style=\"font-weight: 400;\">, for example, are perfect candidates. <\/span><b>Media files tend to be larger in size<\/b><span style=\"font-weight: 400;\">, and transferring them across vast distances can be a slow process. Processing them also tends to take up a lot of resources, and your <\/span><b>CDN provider&#8217;s edge servers<\/b><span style=\"font-weight: 400;\"> are much better set up to deal with this load.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A content delivery network is also perfect for websites that attract users from all over the world. <\/span><b>CDN providers distribute the content across hundreds of servers<\/b><span style=\"font-weight: 400;\"> across the globe, meaning that users will always be close to the website&#8217;s files.<\/span><\/p>\n<p><b>Do all hosting platforms support and benefit from a good CDN?<\/b><\/p>\n<p><span style=\"font-weight: 400;\">As we mentioned already, the benefits you&#8217;re likely to see as a result of an enabled content delivery network depend mostly on the type of website you&#8217;re running. The main web host you use is also a factor, though.<\/span><\/p>\n<p><a href=\"https:\/\/www.scalahosting.com\/web-hosting-for-small-business.html\"><b>Shared hosting<\/b><\/a><span style=\"font-weight: 400;\"> users are the ones who benefit the most from a content delivery network. The resources in a shared hosting plan are limited , and users need all the help they can get. A CDN can do some of the heavy lifting for websites prone <\/span><b>to traffic spikes as well<\/b><span style=\"font-weight: 400;\">, though it can&#8217;t <\/span><b>perform miracles if the peaks <\/b><span style=\"font-weight: 400;\">are too big and too frequent.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When it comes to cloud hosting, <\/span><b>the advantages are slightly less obvious.<\/b><span style=\"font-weight: 400;\"> In general, websites that use cloud hosting solutions are less vulnerable to DDoS attacks, and some might argue that the <\/span><b>extra security provided by CDNs is lost in that respect.<\/b><span style=\"font-weight: 400;\"> What&#8217;s more, some cloud clusters are <\/span><b>spread all around the world and bring additional speed<\/b><span style=\"font-weight: 400;\"> and reliability out-of-the-box. Nevertheless, a highly optimized CDN can still help with the performance and make your hosting more cost-efficient.<\/span><\/p>\n<h2><b>What CDN services should I use?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">The first example of a content delivery network was created back in t<\/span><b>he late-1990s,<\/b><span style=\"font-weight: 400;\"> but it wasn&#8217;t until relatively recently that CDN providers started offering their service to <\/span><b>regular website owners<\/b><span style=\"font-weight: 400;\">. Despite this, there are now so many of them that choosing the right one might be a tall order.<\/span><\/p>\n<p><b>The number of providers is huge<\/b><span style=\"font-weight: 400;\">, and as if that wasn&#8217;t enough, before you make your choice, you need to think about your project&#8217;s requirements and the features you&#8217;re going to need. We believe, however, that the services Cloudflare offers should suit most of our customers&#8217; needs.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Launched in 2010, Cloudflare is now one of the biggest and most <\/span><b>popular CDN service providers<\/b><span style=\"font-weight: 400;\">. It has servers in m<\/span><b>ore than 190 cities across 90 countries<\/b><span style=\"font-weight: 400;\">, and it adds new locations frequently. The years of experience helps it configure and optimize the equipment for the <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/how-to-check-web-hosting-server-speed\/\"><b>best possible speed<\/b><\/a><span style=\"font-weight: 400;\">, <\/span><b>reliability, and security<\/b><span style=\"font-weight: 400;\">, and after you sign up, it will automatically cache your <\/span><b>website&#8217;s static files<\/b><span style=\"font-weight: 400;\"> without the need for any actions on your side.<\/span><\/p>\n<h2><b>How much does it cost?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Most CDN providers offer their services on either <\/span><b>a subscription or a pay-as-you-go basis<\/b><span style=\"font-weight: 400;\">. Because Cloudflare is such a big name in the industry and because it provides a range of other services, it has a plan that lets website owners use its <\/span><b>content delivery network completely<\/b> <b>free of charge.<\/b><\/p>\n<h2><b>How to configure a CDN with ScalaHosting?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Turning on Cloudflare&#8217;s free content delivery network service is as easy as registering your domain name and changing its <\/span><b>DNS settings so that it points to the CDN<\/b><span style=\"font-weight: 400;\">. You can do this by going to Cloudflare&#8217;s own website and following the steps provided there<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><b>Cloudflare<\/b><span style=\"font-weight: 400;\"> will tell you which nameservers you need to point your domain to, and once you&#8217;ve done it, you simply need to leave it some time so that the <\/span><b>changes propagate throughout the web<\/b><span style=\"font-weight: 400;\">. Cloudflare will automatically <\/span><b>cache the static contents of your website and will start serving<\/b><span style=\"font-weight: 400;\"> it from the location nearest to the user. If you feel that your website needs anything more, you can also check out the additional features Cloudflare offers with its paid plans.<\/span><\/p>\n<h2><b>Testing<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">How much the loading times improve will be dependent on the nature of your website, but the effects are likely to be immediately visible. If you want to be sure, however, you can do <\/span><b>a before-and-after test<\/b><span style=\"font-weight: 400;\"> at a website speed testing service like <a href=\"https:\/\/tools.pingdom.com\/\">Pingdom<\/a> or <a href=\"https:\/\/gtmetrix.com\/\">GTmetrix<\/a><\/span><span style=\"font-weight: 400;\">. They can also tell you whether your website uses a CDN, and if it doesn&#8217;t, they will advise turning it on.<\/span><\/p>\n<h2><b>Final takes<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Hosting a website in the 21<\/span><span style=\"font-weight: 400;\">st<\/span><span style=\"font-weight: 400;\"> century is all <\/span><b>about streamlining and optimizing<\/b><span style=\"font-weight: 400;\">. Users click away from websites that take a lot of time to load, and<\/span><b> if you don&#8217;t do everything<\/b><span style=\"font-weight: 400;\"> you can to ensure that the performance is top-notch, <\/span><b>you&#8217;re putting your entire online project at risk<\/b><span style=\"font-weight: 400;\">. A content delivery network is one of the simpler steps you can take in order to <\/span><b>improve your website&#8217;s loading speeds.<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What happens, when a user enters your website&#8217;s domain name into the address bar and hits Enter? Table of Contents What is a CDN? And why should I care? The benefits of using a CDN Is there a bandwidth limit? Can I use it with multiple websites? Do all hosting platforms support and benefit from [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"none","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_analysis_target_kw":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-710","post","type-post","status-publish","format-standard","hentry","category-web-hosting"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=710"}],"version-history":[{"count":5,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/710\/revisions"}],"predecessor-version":[{"id":5701,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/710\/revisions\/5701"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}