Adding Domain Names

NethServer Version: 7.9.2009

Module: certificates, webserver

I had safely installed server3.mydomain.com to use for my main page, and nextcloud.mydomain.com for nextcloud. I was interested in using another domain, mynewdomain.com for nextcloud and added it to the mix and got a certifcate for this one as well.
I was a bit fuzzy on how to do so, and i probably screwed up although i am not clear that you can use a simple domain for a nextcloud install and it has to be a subdomain.
-I have also made them all virtual hosts.
-I have also added the three domains in the server certificates page,.
For the config for nextcloud,
virtual host--nextcloud.mydomain.com
trusted domains-newdomain.com
-nextcloud.mydomain.com

Here are the issues:

  1. I did a check on the certs with ssllabs and the only one visible is server3.mydomain.com.
  2. i cannot seem to edit the nextcloud settings so it will accept mynewdomain.com. I realize it is listed but i cannot really edit anything on that page.

I access the main page of nethserver install with all three, none showing ssl. SSL does work on server3.mydomain:9090

I know i hav screwed this up, so please if someone could point me in the right direction without having to reinstall.

You don’t need to configure a webserver virtualhost in the Server manager in this case.

Thanks Markus. However, it didnt make a change. For some reason, when i do an ssl check, only server3 is showing. The others arent.

Any suggestions besides starting completely over?

Here is the nextcloudconfig

root@server3 ~]# config show nextcloud
nextcloud=configuration
HonorAdStartTls=enabled
TrustedDomains=nextcloud.mydomain.com,newdomain.com
VirtualHost=nextcloud.mydomain.com
Wellknown=disabled

Isnt this correct?

I dont know how to fix it in nethserver…what should i look for?

If you use the Nextcloud VirtualHost setting, you can only use one domain.
You need to unset the Nextcloud virtualhost, then you will be able to use any domain that’s added to the TrustedDomains property but it includes the /nextcloud path.

1 Like

In terms of the certificate, Nethserver is built around the assumption that you’ll only have one. That means that any domain name you want to use needs to be on that one cert. That’s easy enough to do–you can have up to 100 names on a single Let’s Encrypt cert–but that’s the way you need to do it. And then that default cert will apply to Nextcloud and just about anything else. As Markus says, get rid of the virtual host entry for Nextcloud.

1 Like

i appreciate your help here. I am close but nowhere with the new domain. It goes to the nethserver page only without ssl even though i have created a cert.

i have done so as per your advice. I access nextcloud via server3.mydomain.com/nextcloud but i cannot using mynewdomain.com. When i check using ssllabs it says it doesnt exist.

In the config.php
array (
0 => ‘localhost’,
1 => ‘server3.mydomain.com’,
2 => ‘public_ip’,
3 => ‘mynewdomain.com’,
),

config show nextcloud
nextcloud=configuration
HonorAdStartTls=enabled
TrustedDomains=mynewdomain.com
VirtualHost=
Wellknown=disabled

mynewdomain.com/nextcloud should work. You need to append the /nextcloud path.

It does work, but no certificate and if that is my only choice then i might as well go back to a sub-domain.

Please advise

Did you add the domain mynewdomain.com to your LE certificate?

grafik

Hi Markuz,

I have tried that again, and now i only have one certificate for server3.kooltel.com-002.

i put in all the fqdn as well but that is now the only cert.

I think i need to start over and delete all instances of the old certificates or something like that.

I am really stuck here.

i made the changes and even rebooted the server, unfortunately, it still takes me to the main page with no certificate.

Do i need to add a host in the webserver in this case, i realize that you said it wasnt needed but if i dont have a virtual host???

I am reaching but i have no idea otherwise.

As @danb35 already explained here, in NethServer you just have one Letsenrypt certificate that covers all wanted domains.
So you just need to set the new certificate as default and it should work.

No. The Webserver virtualhosts in the server manager are intended for custom web projects that you want to install.
The NethServer apps use their own integrated virtualhost settings.

i think i understand now, the certifcate may say server3.mydomain.com, but it for all domains that are requested…that was not clear to me so thanks for that.

Now i have set the new one as default, as i forgot to check that as i didnt know, and reselected mynewdomain.com as the trusted domain for next cloud with no virtual host, but it is not the default for nextcloud.

All the certificates are working but i cannot access nextcloud without the extension

ok, i guess that is good as it gets. I dont understand why even having a virtual host if you cannot use it in its entirety.

With all the power of this thing, where you can set up a virtual host on the webserver that you cannot do it here.

Sorry for wasting your time.

NethServer aims to be simple to use so it covers common cases. Needing 2 domains without path for the same Nextcloud instance is more like a corner case IMO.

It’s possible to customize things but it’s not manageable via server manager anymore.
To have two virtualhosts without the /nextcloud path you could just copy the apache conf file and replace the domain with the wanted second domain.

To create the right config file:
Enable the Nextcloud virtualhost and enter the first wanted domain. Add both wanted domains to the trusted domains.

Copy the config file:

cp /etc/httpd/conf.d/zz_nextcloud.conf /etc/httpd/conf.d/zz_nextcloud2.conf

Edit the copied config file /etc/httpd/conf.d/zz_nextcloud2.conf and replace the first with the second domain or server3.mydomain.com with mynewdomain.com

Apply the configuration:

signal-event nethserver-nextcloud-save

1 Like

I have done as you stated above. I put in cloud.mydomain.com as my virtual host, added it as trusted domain along with mynewdomain.com. However, when i went to the file nextcloud.conf, it is a bit different.

The Virtual host has two domains and they are both the same.

Please note that it is pretty unexpected that you have to use subdomain for nextcloud…I thought i could simply call it newdomain.com and that would be the end of it.

The rest of the server seems to offer very complex services.

# ================= DO NOT MODIFY THIS FILE =================
# 
# Manual changes will be lost when this file is regenerated.koo
#
# Please read the developer's guide, which is available
# at NethServer official site: https://www.nethserver.org
#
# 
<VirtualHost *:80>
    IncludeOptional conf.d/default-virtualhost.inc
</VirtualHost>

<VirtualHost *:80>
   ServerName cloud.mydomain.com
   RedirectMatch 301 ^(?!/.well-known/acme-challenge/).* https://cloud.mydomain.com
</VirtualHost>

<VirtualHost *:80>
  ServerName cloud.mydomain.com
  Redirect / https://cloud.mydomain.com/
</VirtualHost>

<VirtualHost *:443>
  ServerName cloud.mydomain.com
  SSLEngine on
  RewriteCond %{HTTPS} !=on
  RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

  Alias / "/usr/share/nextcloud/"
  <Directory "/usr/share/nextcloud">
    Options +FollowSymLinks
    AllowOverride All
    Require all granted

    <IfModule mod_dav.c>
      Dav off
    </IfModule>

    <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000"
    </IfModule>

    <FilesMatch \.php$>
      SetHandler "proxy:unix:/var/run/rh-php80-php-fpm/nethserver-nextcloud-php80.sock|fcgi://localhost"
    </FilesMatch>

    SetEnv HOME /usr/share/nextcloud
    SetEnv HTTP_HOME /usr/share/nextcloud
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  </Directory>

  <Directory "/usr/share/nextcloud/data/">
    # just in case if .htaccess gets disabled
    Require all denied
  </Directory>
</VirtualHost>

The correct file to edit is /etc/httpd/conf.d/zz_nextcloud2.conf.
Sorry, I don’t understand…Is something not working?

You can choose any domain that points to your server, no matter if it’s a subdomain or not.

…as long as isn’t the server’s primary FQDN.

1 Like

The correct file to edit is /etc/httpd/conf.d/zz_nextcloud2.conf .
Sorry, I don’t understand…Is something not working?

Yes, it is not as you described. The sample file is actually zz_nextcloud.conf…and as you can see there is one domain only.

I am confused, i thought i had to choose a subdomain as a virtual host…

I simply want to use mynewdomain.com…which is completely different from the main server domain, which is server3.mydomain.com. It points to the server and i would like to use it for nextcloud…as either a virtual host, or trusted domain or both…I dont care…just preferred not to use a subdomain for nextcloud…