Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Cloudflare CDN and NGINX

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

like image 972
Igor-Vuk Avatar asked Jun 11 '18 00:06

Igor-Vuk


People also ask

Do I need NGINX if I have Cloudflare?

Cloudflare would not exist without NGINX. “NGINX is core to what Cloudflare does. It is part of the foundational pieces of software we use.

Does Cloudflare use NGINX?

Cloudflare has "outgrown" Nginx and ended up creating their own HTTP proxy stack. Cloudflare found that Nginx's worker process architecture was hitting drawbacks, particularly around CPU resources. Nginx also proved to be difficult to extend to their needs.

Does Cloudflare replace NGINX?

As Cloudflare has scaled we've outgrown NGINX. It was great for many years, but over time its limitations at our scale meant building something new made sense. We could no longer get the performance we needed nor did NGINX have the features we needed for our very complex environment.

Can NGINX be used as CDN?

NGINX is a high‑performance web server, load balancer, and proxy that our CDN network uses to deliver our customers' content as fast as possible. In the past few years, more high‑traffic websites have started using NGINX as their high‑performance server.


2 Answers

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.

like image 194
nbari Avatar answered Sep 28 '22 17:09

nbari


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.

like image 41
Kenton Varda Avatar answered Sep 28 '22 15:09

Kenton Varda