Adding Domain Names

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…

i simply choose mynewdomain.com for the trusted host for nextcloud, and when i go to it, i get the main page for nethserver. The strangest part, is that even though i didnt select a virtual host, i can still reach /nextcloud from any FQDN pointing to the server.

I not made any change to any config settings other than adding the country for the phone number, which doesn’t work.

I thought you want to use server3.mydomain.com and mynewdomain.com as Nextcloud virtualhost without needing the /nextcloud path.

If /etc/httpd/conf.d/zz_nextcloud2.conf exists, please delete it.
Just set mynewdomain.com as Nextcloud virtual host in the server manager and add the domain to the trusted domains.

Now it should be possible to go to Nextcloud via https://mynewdomain.com and not via https://server3.mydomain.com/nextcloud anymore.

1 Like

That’s is the one shipped with the installed package.
The one Markus is refering to is to create a new file to allow you to have more than one virtual host for nextcloud

1 Like

That is exactly what I did, it doesn’t work without /nextcloud for any domain. All domains point to nethserver splash page and all wor with /nextcloud., including my new domain.com even though it is the only selection as a trusted domain for nextcloud.

This is not what I was trying to accomplish

Hm, that’s weird, it should just work.

Maybe it helps to reconfigure Nextcloud:

signal-event nethserver-nextcloud-update

Let’s check the virtualhosts used in apache:

httpd -S

and the Nextcloud config:

config show nextcloud

1 Like

no change

VirtualHost configuration:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server server3.mydomain.com (/etc/httpd/conf.d/virtualhosts.conf:12)
port 80 namevhost server3.mydomain.com (/etc/httpd/conf.d/virtualhosts.conf:12)
port 80 namevhost server3.mydomain.com (/etc/httpd/conf.d/zz_mattermost.conf:9)
port 80 namevhost mattermost.mydomain.com (/etc/httpd/conf.d/zz_mattermost.conf:13)
*:443 is a NameVirtualHost
default server server3.mydomain.com (/etc/httpd/conf.d/nethserver.conf:41)
port 443 namevhost server3.mydomain.com (/etc/httpd/conf.d/nethserver.conf:41)
port 443 namevhost server3.mydomain.com (/etc/httpd/conf.d/ssl.conf:56)
port 443 namevhost mattermost.mydomain.com (/etc/httpd/conf.d/zz_mattermost.conf:18)
ServerRoot: “/etc/httpd”
Main DocumentRoot: “/var/www/html”
Main ErrorLog: “/etc/httpd/logs/error_log”
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir=“/run/httpd/” mechanism=default
PidFile: “/run/httpd/httpd.pid”
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name=“apache” id=48
Group: name=“apache” id=48

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

hopefully this will tell the story