Difference between Cloudflare CDN and NGINX
Asked Answered
S

2

16

I am reading but having hard time understand difference between the two. I am using Heroku for my apps and until now I was using NGINX to serve my content. I precompressed my static files to gzip and served them like that, turning off dynamic compression in NGINX config file.

Now I am learning about Cloudflare CDN. As I see it is also serving static content. Is there any point in using both NGINX and Cloudflare, what would be the benefits?

How does a flow of that goes when user visits the website?

Would it be:

End User -> Cloudflare DNS -> CDN -> NGINX -> Heroku

End User <- Cloudflare DNS <- CDN <- NGINX <- Heroku

Shuttle answered 11/6, 2018 at 0:34 Comment(0)
M
14

Cloudflare does not serve static content itself. It only caches content originally served by some other server. You still need that other server -- known as your "origin server". You might still use nginx as your origin server. By putting Cloudflare in front of it, you can make your site faster and more secure, but Cloudflare does not replace your server.

Margravine answered 12/6, 2018 at 0:44 Comment(2)
Thanks. But when will this origin server Nginx be hit. Only on first load right? When Cloudflare caches the content it is not hitting him anymore if I undrestand correctly?Shuttle
It depends on your caching settings. You can configure Cloudflare to keep data cached for a specific amount of time (an hour, a day, etc.) before it reloads from the origin. Cloudflare may also re-request content for its own reasons -- for example if it runs out of disk space or a machine fails then Cloudflare may have to discard some cached content and then fetch it again the next time it is needed. Caches are not intended to be reliable storage, only a way to speed up your site "most of the time".Margravine
B
6

From, How does Cloudflare work?:

The Short Answer, Cloudflare protects and accelerates any website online. Once your website is a part of the Cloudflare community, its web traffic is routed through our intelligent global network.

enter image description here

In terms of differences, you can't directly compare Nginx with a CDN (a group of services including Nginx), you can create a CDN using Nginx.

Buhrstone answered 11/6, 2018 at 20:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.