Home > The Newbie Zone > Questions and Answers

How does a VPS talk to a CDN? (4)


08-14-2019 01:53 AM #1 midasmulligan (Member)
How does a VPS talk to a CDN?

hello,

newbie question on CDNs.

I have been reviewing methods to host landing pages. I want to start by using Vultr to host pages, and Cloudflare as a CDN.

However, I am still a little unclear on how the relationship between the server and CDN will work logistically.

If I point the name servers to the VPS, and then point additional name servers to the CDN, how do the CDN and VPS talk to each other?

Hopeufully this question make sense. Thanks in advance!


08-14-2019 02:40 AM #2 erikgyepes (Moderator)

CloudFlare has actually 2 ways to function: as a CDN (orange cloud activated) or just as a DNS.

In the first case imagine it as some layer in front of your VPS, your landers will be cached on the CDN side and lower the load on your VPS.
With the second option you will get only a super fast DNS servers ie. your DNS requests made will be faster than with some average DNS offered by your domain registrar.

Some people also host their landers purely only on CDN like Amazon or RackSpace, in this case they not use VPS at all (not really possible with CloudFlare, as it's functioning differently).

In this case though you can serve only client side code like HTML, JavaScript, stylesheets and images, no server side code as PHP.

The easiest way to remember: CDN for static client side code, VPS when you need server side code processing like PHP.

So it all depends from your needs how you want to do your setup.


08-16-2019 12:08 PM #3 midasmulligan (Member)

Thanks Erik!


08-19-2019 05:36 PM #4 nickpeplow (AMC Alumnus)
How does a VPS talk to a CDN?

A CDN is basically a copy of your website (images, scripts etc) stored all over the world, so it’s closer to your users.

If someone In Europe visits a website in america, normally the user has to do all sorts of hops through the country, underwater cables, perhaps even all the way across countries etc... it’s slow. But a CDN has a copy nearby so it loads much quicker.

You replace links to your images and other files with the special one the CDN provides. When a user visits, they check the country and either serve the file from the nearest server, or grab a fresh copy from your site and serve it up.

The link you get from the cdn will be nearly identical to yours, all the content is in the same place

yourdomain.com/cat.jpeg
yourdomain.keycdn.com/cat.jpeg

Cloudflare is even smarter though. If you use them for your website DNS (complicated word for pointing at your server) then they throw in a basic CDN for free and hook it all up automatically




Sent from my iPhone using STM Forums mobile app


Home > The Newbie Zone > Questions and Answers