Allow multiple URLs for Nextcloud?

NethServer Version: 7.6
Module: nethserver-nextcloud

I’ve had Nextcloud running for a while under my primary domain name (www.mydomain.com/nextcloud). I’d like to transition that to a separate domain (e.g., mycloud.com), but (at least temporarily) keep it accessible at the old URL as well. Is this possible?

Edit: Looking through the templates, it kind of looks as though it works this way by default–if you do config setprop nextcloud VirtualHost mycloud.com, that doesn’t disable access via maindomain.com/nextcloud. Is it that simple? If so, the only remaining question is how hard it would be to set a separate TLS cert for the VirtualHost, as that doesn’t seem to be an accessible property.

Edit 2: No, apparently it doesn’t work that way. When I set VirtualHost and TrustedDomains to mycloud.com, browsing to maindomain.com/nextcloud now gives me 404. And browsing to https://mycloud.com redirects endlessly to itself. Strange.

Edit 3: OK, removing the else statement on line 57 of the template fragment and setting TrustedDomains to mycloud.com,maindomain.com, with VirtualHost at mycloud.com, still allows maindomain.com/nextcloud to work. However, mycloud.com is still endlessly redirecting to itself.

It may work with an additional ServerAlias in the vhost to add several domains:

http://httpd.apache.org/docs/current/mod/core.html#serveralias

EDIT:

OK, forget it, I misunderstood the target :upside_down_face:

…and now that I’ve disabled Cloudflare for the domain, it works. Strange. maindomain.com works just fine with Cloudflare. Looks like some further investigation will be in order.

So, my conclusions at this point:

  • With the stock configuration, it is not possible to have Nextcloud accessible at both maindomain.com/nextcloud and at a separate virtualhost name.
  • A slight tweak to the zz_nextcloud.conf template to remove the else statement resolves the above
  • It does not appear to be possible to specify a cert for the Nextcloud virtual host; that hostname will need to be part of the default cert.

You may copy the vhost to a custom template /etc/e-smith/httpd.conf/zz_nextcloud.conf/90addvhost or just to a new conf file in /etc/httpd/conf.d/, change the servername and the alias accordingly and set the cert manually:

<VirtualHost *:443>
  ServerName other.domain.tld

  SSLEngine on
  SSLCertificateFile /etc/pki/tls/certs/yourcert.crt
  SSLCertificateKeyFile /etc/pki/tls/private/yourkey.key
  ...