Can NextCloud be used as CDN / Object storage?

I have no support/technical question and have seen the support category. (Be aware that direct support questions will be deleted.)

on

Which general topic do you have

Hello,

Is it possible (and a good idea) to use NextCloud as a CDN provider for images, documents etc on a large site. We have our organisations assets in NextCloud and duplicate some of those manually to our websites image library. It would be ideal if we could just share those assets with the websites instead of duplicating them.

I am wondering if NextCloud could handle those webserver requests to it or maybe there is a better way for this? to connect with an external object storage provider?

Unfortunately, I did not fully understand your enquiry. But I don’t think what you have in mind is a good idea.

You probably want an image to be displayed or downloaded directly. To do this, you can add /download to any share such as https://cloud.server.tld/s/abcdefghijklmo or from Nextcloud 31 onwards, e.g. https://cloud.server.tld/s/name. With https://cloud.server.tld/s/abcdefghijklmo/download or https://cloud.server.tld/s/name/download you can then try to embed images directly from Nextcloud in websites e.g. with <img>, for example. Yo do not need to allow download in the sharing options. Feel free to try this out for a few examples.

The problem, however, is that you will probably have to create a share for each file.

Alternatively, you can use a normal web server e.g. apache2 (not a content management system). There you can store the images such as image.jpg under /images, disallow directory access in .htaccess and then simply link them as is standard with <img>, e.g. www.server.tld/images/image.jpg. Of course, this is not a CDN either.

You can also share directorys in Nextcloud. But then it is a normal Nextcloud share of a directory. Maybe you can then include directorys with External Storage. These can really be external or even on the same server.