Forced https in virtualhost prevents login credentials

I have nextcloud 16 running in Fedora with apache, so httpd. It worked fine with http, users could log in and do whatever.

I followed the hardening guide for setting https with tls from here:
https://docs.nextcloud.com/server/16/admin_manual/installation/harden_server.html#use-https

I added both of the virtual host configs verbatim to the file z-nextcloud-config(the exact file name might be different im not at cpu right now, it was z-nextcloud-something).

Now I can log into the server but any username or password I enter does not work, like the log in credentials arent being referenced anymore.

My only thought is that maybe the vitualhost lines need to be added before the directory lines? Or perhaps I edited the wrong file.

It seems to be a simple goof up to fix if anyone has a suggestion as to what I did wrong

I looked into this issue a little more. Nextcloud would work with its origional address, but when I added the apache virtual host information to the config file it somehow created a new instance called cloud.nextcloud.com…at least as far as my browser could tell. It had a login page but no user credentials.

I would like to configure nextcloud with the virtual host enabled, to enforce https and hsts. If i try to enable this again should I replace “cloud.nextcloud.com” with “mydomain.com” ?

You should replace both with your own FQDN. Those examples were not meant to be used verbatim.

Ah, and just to be extra careful do i call it “mydomain.com/nextcloud” or can I omit the /nextcloud part? Does the address always need /nextcloud added on?

That depends entirely on how you set it up. If Nextcloud is in a subfolder of your document root called nextcloud then it would be /nextcloud.