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-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).