Nextcloud Update / Error Message / "/nextcloud/ocm-provider/"

G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=23
G_DIETPI_VERSION_RC=3
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’
G_LIVE_PATCH_STATUS[0]=‘applied’
bookworm 1
Linux DietPi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
armhf
RPi 3 Model B (armv7l)

Additional Information (if applicable)

  • Software title | Nextcloud
  • updated recently

Hi,
today I made an Update for my Nextcloud Instance. The Webserver is Lighttpd. I then got the following Error Message:
“Dein Webserver ist nicht ordnungsgemäß für die Auflösung von “/nextcloud/ocm-provider/” eingerichtet. Dies hängt höchstwahrscheinlich mit einer Webserver-Konfiguration zusammen, die nicht aktualisiert wurde, um diesen Ordner direkt zu liefern.”

I have then searched the web and found a possible Solution, but I am not sure in which File the Changes have to be done. Can you please help me?

# For nextcloud on a sub-directory
url.rewrite-once += (
        "^/nextcloud/ocm-provider/?$" => "/nextcloud/index.php?$1"
)

This possible Solution is at the bottom of the Page

1 Like

Yes a bug within Nextcloud or a recent change. We found same for Apache web server in Nextcloud GitHub Error Message after Nextcloud update to 27.1.2 - #7 by Joulinar

There should be a NC configuration file at /etc/lighttpd/conf-enabled. Just have a look

It’s /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf and you have to add it in the block, like:

$HTTP["url"] =~ "^/nextcloud($|/)" {
	url.rewrite-once += ("^/nextcloud/ocm-provider/?$" => "/nextcloud/index.php?$1")

...other config stuff here ...
}

and reload the config (since we edited a file from conf-available and not directly from the conf-enabled folder )
systemctl force-reload lighttpd.service

Thank you. This is the File how it looks actually:

cat /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf
# Derived from:
# - Apache: https://github.com/nextcloud/server/blob/d56b1c28bab3daa3425d3ea552e34b0e607f08a3/.htaccess
# - Nginx:  https://docs.nextcloud.com/server/stable/admin_manual/installation/nginx.html

# Redirect OCM/OCS provider requests to Nextcloud endpoint:
url.redirect += (
	"^/.well-known/webfinger" => "/nextcloud/index.php/.well-known/webfinger",
	"^/.well-known/nodeinfo" => "/nextcloud/index.php/.well-known/nodeinfo"
#	"^/ocm-provider" => "/nextcloud/ocm-provider",
#	"^/ocs-provider" => "/nextcloud/ocs-provider"

)

$HTTP["url"] =~ "^/nextcloud($|/)" {

	# Hardening
	# - Directories
	$HTTP["url"] =~ "^/nextcloud/(build|tests|config|lib|3rdparty|templates|data)($|/)" { url.access-deny = ("") }
	# - Files
	$HTTP["url"] =~ "^/nextcloud/(\.|autotest|occ|issue|indie|db_|console)" { url.access-deny = ("") }
	# - Directory listing
	dir-listing.activate = "disable"
	# - Cache control and security headers for static resources
	$HTTP["url"] =~ "^/nextcloud/.+[^/]\.(css|js|woff2?|svg|gif|map)$" {
		setenv.add-response-header += (
			"Cache-Control" => "public, max-age=15778463",
			"Referrer-Policy" => "no-referrer",
			"X-Content-Type-Options" => "nosniff",
			"X-Download-Options" => "noopen",
			"X-Frame-Options" => "SAMEORIGIN",
			"X-Permitted-Cross-Domain-Policies" => "none",
			"X-Robots-Tag" => "none",
			"X-XSS-Protection" => "1; mode=block",
		)
	}

}

Something went wrong. I´ve tried to insert the lines, but was unsure where exactly. The result is I can not reach the Site at the moment. When reverting those entries, everything works - but the error remains. Can you please assist me?

Put it directly under:

$HTTP["url"] =~ "^/nextcloud($|/)" {

Like in my example

Thank you very much. Problem is solved.
There was a “)” missing at the end of the line.

1 Like

Oh yes, you are right. I corrected it above.

I wonder why this never appeared earlier with Lighttpd. Those rewrites exist for a long time :thinking:. For Apache it is solved via .htaccess, for Nginx, we use a generic method to rewrite everything automatically based on whether the dir exist or not. AFAIK there is no such generic method possible for Lighttpd, so we need to add this and some other rewrites manually:

	# Rewrites
	url.rewrite-once += (
		"^/nextcloud/remote/(.*)" => "/nextcloud/remote.php/$1",
		"^/nextcloud/ocm-provider($|/\?.*)" => "/nextcloud/index.php$1"
	)
	url.rewrite-if-not-file += (
		"^/nextcloud/((core/ajax/update|cron|public|remote|status|ocs/v[12])\.php|ocs-provider/|updater/)" => "",
		"^/nextcloud(.*)" => "/nextcloud/index.php$1"
	)

To test it, I did just setup a fresh instance and there I do not see the admin panel warnings, strangely. However the rules should be added regardless.

I checked some docs and the above rewrites should mimic the .htaccess precisely. Could you add this to your $HTTP["url"] =~ "^/nextcloud($|/)" { block to assure it mutes the warning (which does not appear in my case), and whether everything else as well works without issues?

1 Like

Could someone who was affected by the admin panel warning test this config please:

curl -sSf 'https://raw.githubusercontent.com/MichaIng/DietPi/6c3352e/.conf/dps_114/lighttpd.nextcloud.conf' -o /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf
systemctl restart lighttpd

Works for me on DietPi 8.23.3 and latest Nextcloud (Nextcloud Hub 6 (27.1.3))

1 Like