Any app to provide static web site from NC?

I have a user that created a static web site (imgs, html files and CSS), is there any NC app that allows him to share the folder as a “web site” instead of showing the source html ?

I am aware of the PICO CMS app but it’s no longer maintained and that’s start from markdown files, while here it is even simpler, it’s a matter of just serve the files as web pages…

Before I was using custom apache configuration, but now we moved to a managed NC instance, so I am looking how I can keep it…

Disclaimer:

Enabling direct HTML rendering is DANGEROUS. You should activate it only if you know what you are doing. This can easily break the whole page and add potential leaks. You have been warned.

After having said that, here how it works:

You need this tiny app, not listed in the appstore:

You can simply create your website somewhere inside of a folder. After sharing that folder, you have to prepend /apps/raw/ before the /s/$token, so your link to the website would look something like

  • https://cloud.foo.bar/apps/raw/s/$sharetoken

If you like, you can create some rewrite rules to beautify the url in your .htaccess:

    RewriteRule ^sites/(.*)$ /apps/raw/s/$1 [R,L]

and with an app like

  • Configurable Share Links - cfg_share_links
(unfortunately not yet completely compatible with nextcloud 28)

… you can create sharetokens of your choice, so that you can create urls to your website(s) like:

  • https://cloud.foo.bar/sites/my_beautifull_name

and the raw app will serve the index.html

raw comes with a restrictive csp:

		header( // Add a super strict CSP: no connectivity allowed.
			"Content-Security-Policy: sandbox; default-src 'none'; img-src data:; media-src data:; "
			. "style-src data: 'unsafe-inline'; font-src data:; frame-src data:"
		);

You may want to remove one or two of them, if you e.g. want to enable video playback but you have been warned, its dangerous :wink:

There may be some more posibilities, but this one is my personal favourite.

Much and good luck,
ernolf

This is what PicoCMS for Nextcloud do. But it is not maintained and not supported on the last major versions. Unfortunately. I would setup a static website in the same webserver that serves Nextcloud instead, which document root points to a specific folder of a user of tour own choice. You can even then use the same certificate as for Nextcloud, if you just makes the servername https://your.ncdomain.dom/website

But thats just me though. :slightly_smiling_face:

1 Like