DigitalOcean - CloudFlare CDN & Self-Hosted CDN

Hello Friends, I’m trying to decrease server response time as per Google PageSpeed Insights recommendation. They’re saying “You should reduce your server response time under 200ms” and my server response time is approx 1.3 seconds. So I decide to make my own self-hosted CDN server by guideline of

But the question “I’M ALREADY USING CLOUDFLARE CDN (FREE PRODUCT)”. I really need to close CloudFlare account? OR I can setup my self-hosted CDN without stop using CloudFlare?

Thank you!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer


There’s a relatively large difference between CloudFlare, which uses hundreds to thousands of web servers that are geographically dispersed to various locations across the US and other countries and using a single-server to serve static content from a single location.

For example, using a single server may provide some benefit if all your visitors are coming from one specific location, such as New York. But what happens when someone visits your site from a state or country that’s relatively distant from the data center you’re serving the static content from?

I’m in Tennessee, so content being served from New York isn’t going to impact me – it’ll be quick to serve and I’ll be a happy camper. However, if I lived in California, the response time of the server in New York is going to be much higher than the response time from where I am in Tennessee.

For example, when I ping an IP in the NYC 2 data center, the average is about 38ms – that’s pretty quick. Now when I ping an IP in the in SF 2 data center, the average is about 115ms, that’s 3x slower for me due to distance.

You can setup your own CDN, though the time it’d take to manage a true CDN cluster dispersed across numerous data centers, with GeoIP targeting, would far outweigh the cost of even CloudFlares cheapest paid plan @ $20/site.

DigitalOcean doesn’t have enough data centers to match CloudFlare’s ability to deploy anywhere right now (that may very well change – DigitalOcean is growing fast!), so at best, you have 12x data centers you can deploy to. CloudFlare has 111 right now.

Using only 512MB Droplets, that’s $60/month, not counting the cost of server management and the additional cost of using a DNS provider (such as Amazon) that is capable of handling Geo DNS.

That being said, when it comes to the speed at which your site is served, a CDN is only a small fraction of a percentage.

You need to work on optimizing your LEMP stack, specifically NGINX and MariaDB to start. If you’re able to optimize your code (PHP), then factor that in as well. The default configuration for normal repository packages that you install with apt or apt-get are not optimized for production. They need to be tweaked/tuned according to the needs of your website(s).

If you’re not able to do that, I’d recommend hiring a sysadmin (hey…I’m available :-) - seriously). A CDN, however, won’t be a magic cure all, even if you did setup your own.

The above, of course, excludes other benefits that CloudFlare provides, that you would also need to setup on your own, if you went the self-hosted route. This ranges from Auto-SSL, a degree of DDoS protection, protection for your IP’s, etc (all of which come with the free accounts).

@chinmayrajyaguru the Free Plan of CloudFlare has a CDN for images too?


@chinmayrajyaguru You might benefit from when it is released. From the makers of

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel