Nextcloud in a domain/subdirectory and as subdomain

Hi Community,

i would like to have my nextcloud-installation for migration purposes listen to:

https://www.mydomain.com/nextcloud --> installed in apache as an alias! its no directory under webroot!
and
https://cloud.mydomain.ch

the 1st workst since years, now i would like to migrate. I installed my subdomain as a vhost on apache, the call works, but i get a Server Error when calling my subdomain.

if if append /nextcloud to my subdomain, it works (it’s the same server)

Thanks in advance!

Can you post your vhost config file? Most likely you have a reference to the subdirectory there, which must be removed.

Default host:

<VirtualHost *:80>
ServerAdmin [webmaster@mydomain]
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

ServerAlias [mydomain]
ServerAlias [www.mydomain]

RewriteEngine on
RewriteCond %{SERVER_NAME} =[mydomain] [OR]
RewriteCond %{SERVER_NAME} =[www.mydomain]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Virtual Host:
<VirtualHost *:80>
ServerName [cloud.mydomain]

ServerAdmin [webmaster@mydomain]
DocumentRoot /usr/share/owncloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =[cloud.mydomain]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

and the config for the subdirectory:

Alias /owncloud /usr/share/owncloud

<Directory /usr/share/owncloud/>
Options +FollowSymLinks
DirectoryIndex index.html index.php
Header set Referrer-Policy “no-referrer-when-downgrade”
AllowOverride All
= 2.3>
Require all granted

<IfVersion < 2.3>
Order allow,deny
Allow from all

possibly have to change .htaccess in /usr/share/owncloud?

Did you manage to make it work? I’m reying to do the same thing