Apache with two different domains?

Hello,

we are using NC at the moment with a subdomain nextcloud.domain1.com
The cert. in the apache config for the vhost is for *.domain1.com

Now we want to use the NC instance with an additional domain request, nextcloud.domain2.com, which is also pointing to the NC server in DNS.

I added the second URL to the trusted domains in the NC config, which seems to work. But now We have the problem that of course we get an certificate error, since the nextcloud.domain2.com responds with the *.domain1.com certificate.

Am I able to config two virtual hosts in apache, one with nextcloud.domain1.com and *.domain1.com cert and one with nextcloud.domain2.com with *.domain2.com cert, which are both pointing to the same vhost directory under /var/www/nextcloud ?

hi @horst let me google this for you :wink: you don’t even need two virtual hosts but you only need to add a ServerAlias and obtain correct certificate (search term is “SAN”)

Thx for your help, I configured another site with the second domain and provided the corresponding certificate;
regarding NC everything worked so far;

but since we are using SAML/SSO with an MS ADFS Server, the project with the second domain died right here;
I was not able to extend the Nextcloud SAML configuration to work with both/two domains in parallel;

I’m going to ask pre-emptively, if you don’t mind:

I’m needing to build up a new server but need to keep the existing one up and running while I get that far with the new build. I’ll need to purchase a new domain to go with, as the one in use is temporary anyway.

The question/concern I had is, can I point to more than one NextCloud server under multiple domains and multiple physical servers at the same IP address? I’m assuming I can, as I’d imagine that’s how a server farm works. Would I effectively be doing the same thing outlined here, just in separate machines, rather than just separate ServerAlias/Names in a single system?

this exactly the purpose of a reverse proxy. Please familiarize yourself with the technology and perform some testing before you start the project.

server farm term usually translates into “running multiple servers for same application” in most cases for load balancing/higher scaling. And no your goal would fit into original direction from OP - you can define multiple virtual hosts on one reverse proxy to address different applications/domains running on different servers.

This is what I needed to know, Thank you!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.