Nextcloud Apache virtualhost and ocm-provider/ocs-provider redirect

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
Posts: 7
Joined: Sun Jul 21, 2019 7:35 pm

Nextcloud Apache virtualhost and ocm-provider/ocs-provider redirect

Post by maximumwarp »

I installed via dietpi-software Nexcloud. It seems to run well but in settings I have two warnings about ocm-provider and ocs-provider. On my Pi I use a LAMP stack and I configured Nextcloud with nextcloud.mydomain.tld.
This is my Apache2 virtual host file for Nextcloud:

Code: Select all

<VirtualHost *:80>
  ServerName mydomain.tld
  ServerAdmin admin@mydomain.tld
  DocumentRoot /var/www/nextcloud
  <Directory /var/www/nextcloud>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
    SetEnv HOME /var/www/nextcloud
    SetEnv HTTP_HOME /var/www/nextcloud
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  RewriteEngine on
  RewriteCond %{SERVER_NAME} =nextcloud.mydomain.tld
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Code: Select all

# Redirect OCM/OCS provider requests to Nextcloud endpoint:
Redirect permanent /ocm-provider /nextcloud/ocm-provider
Redirect permanent /ocs-provider /nextcloud/ocs-provider
doesn't solve the problem.

Can anyone help me?
User avatar
Site Admin
Posts: 2510
Joined: Sat Nov 18, 2017 6:21 pm

Re: Nextcloud Apache virtualhost and ocm-provider/ocs-provider redirect

Post by MichaIng »

It looks like you want Nextcloud being reachable without subdir, right?
In this case no redirect rules are required, even wrong, redirecting to non-existent paths.
If you installed Nextcloud via dietpi-software and just edited the default vhost, then you must disable the drop-in config that we place to set the right rules for /nextcloud subdir: Removing the redirect lines you added and running a2dissite dietpi-nextcloud && systemctl reload apache2 should resolve the issue.

Redirect permanent /ocm-provider /nextcloud/ocm-provider
This means that all requests to /ocm-provider path, relative to the webroot, are redirected to /nextcloud/ocm-provider subdir, relative to the webroot. Since you webroot is /var/www/nextcloud, this means:
/var/www/nextcloud/ocm-provider is redirected to /var/www/nextcloud/nextcloud/ocm-provider, while the first path is already correct and the second does not even exist ;).
Post Reply