Serve shared files from a CDN

Hello,

I’m looking for a CDN app or a solution to serve my shared files from a CDN url. (Direct link)

My NextCloud site is used worldwide, I need to have fast download speed everywhere.

Example:

Origin: https://mysite.cloud/ID/download/video.mp4
CDN: https://cdn.mysite.cloud/ID/download/video.mp4

Is there a way to make this work with NGINX? Maybe with a custom app?

(Cloudflare doesn’t allow the caching of huge mp4 files, I need to use a real CDN)

Thank you.

Not sure if I understand you correctly, but just adding a cdn subdomain to your server isn’t going to help with faster download speeds. CDN stands for Content Delevery Network. So if you want to run your own CDN, which is possible, you gonna need several servers / VPSs in different regions of the world, which are able to cache and deliver your content. Here is an article about how something like this could be setup: https://dev.to/megajakob/how-to-build-your-own-cdn-io1

The Enterprise plan allows for 5GB.

If you’re not an “Enterprise,” it’s probably going to be tough. So you may want to reconsider whether you really need this. If it is only “nice to have”, you probably want to let it be or use other services to serve these files, instead of using your own server. Otherwise, you either have to spend a lot of money (Enterprise plan), or you can spend a little less money, but instead of that you have to put a lot more effort into it (the tutorial above). Or maybe there are other CDN providers besides Cloudflare, which are cheaper and / or have higher limits for the caching in their lower tier plans, not sure about that.

Beside of all that, I am not sure how easy it would be, or if it is even possible to split the content from a Nextcloud instance, in order to serve only shared files via external CDNs. I am also not aware of any app that can help with that. Maybe a Nextcloud cluster spread over several regions world would be the better solution for this. However, you probably won’t find much detailed help for any of these topics in the forums, because this is not a use case that home or small business users usually encounter.

1 Like

Bunny.net automatically cache the files worldwide, but you need to use their domain or a custom domain that point to their servers to serve the files.

It is easy to implement something like this on Wordpress but I can’t find anyone talking about this for Nexcloud. It is strange for a files storage software to not have any CDN support.

Way too expensive.

Try asking the cdn directly. It has no direct connection to Nextcloud.