Unable To Access Nextcloud Post Install or Authorisation Pages

## The Basics

* Nextcloud Server version _(e.g., 29.x.x)_:

  • Latest
    * Operating system and version _(e.g., Ubuntu 24.04)_:
  • Debain 13 Trixie
    * Web server and version _(e.g, Apache 2.4.25)_:
  • Latest
    * Reverse proxy and version _(e.g. nginx 1.27.2)
  • N/A
    * PHP version _(e.g, 8.3)_:
  • 8.5.7
    * Is this the first time you’ve seen this error? (Yes / No):
  • No
    * When did this problem seem to first start?
  • Every time!
    * Installation method _(e.g. AlO, NCP, Bare Metal/Archive, etc.)_
  • Bare Metal in a virtual Linux PC
    * Are you using CloudfIare, mod_security, or similar? _(Yes / No)_
  • No

### Summary of the issue you are facing:

In simple terms, this is my process:

  • Build a VM (I’ve tried both VirtualBox and Hyper-V).
  • Ensured it can communicate with my physical network (Bridged adapter or External Switch).
  • Built VM using Debian r13.2.0 (updated to latest).
  • Installed XRDP (works AOK).
  • Installed Apache 2 (tested as reachable from physical computer).
  • Installed latest PHP (8.5.7, includes MySQL).
  • Configure MySQL.
  • Download and extract Nextcloud (latest) then create the data directory, apply ownership/permissions (chown & chmod 750).
  • Created the nextcloud.conf file (/etc/apache2/sites-available/nextcloud.conf):

Alias /nextcloud “/var/www/nextcloud/”
DocumentRoot “/var/www/nextcloud”
# ServerName
ErrorLog ${APACHE_LOG_DIR}/nextcloud.error
CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews

Dav off

Run a2ensite NextCloud.conf
Rebooted

Everything is fine at this point so I run the Nextcloud initial screen, filling in the proper details:

NX Admin Username:
Password:
MySQL DB Name:
MySQL DB Username:
MySQL DB User Password:

When I click “Install” (might be “Submit”) it can’t find my page even if I edit the link to include the Nextcloud VM IP address.

I have tried this countless times and I’m unsure whether it’s a “feature” of VMs or whether I’m getting something completely wrong.

NOTES:

  • I CAN do this inside the VM, just not outside the VM which effectively makes it useless.
  • I’ve tried connecting a client and can’t get to the authorisation page.

Any helpful advice appreciated.

James

Are you attempting a directory-based installation or a virtual host based implementation? Your config sort of seems to attempt to combine both.

Thanks :slight_smile:

So, I checked that out and, after restoring my VM from a virtual backup (exported earlier than MYSQL configuration or the Nextcloud install), I did the following:

I configured MYSQL:

CREATE DATABASE IF NOT EXISTS <MySQL DB Name> CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER '<MySQL DB Username>'@'localhost' IDENTIFIED BY '<MySQL DB User Password>';
GRANT ALL PRIVILEGES ON <MySQL DB Name>.\* TO '<MySQL DB Username>'@'localhost';
FLUSH PRIVILEGES;

Installed Nextcloud:

Configured Nextcloud:

  • Created new nextcloud.conf (nano /etc/apache2/sites-available/nextcloud.conf):
<VirtualHost \*:80>
        DocumentRoot /var/www/nextcloud/
        ServerName  servername.workgroup

        <Directory /var/www/nextcloud/>
                Require all granted
                AllowOverride All
                Options FollowSymLinks MultiViews

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

        </Directory>
</VirtualHost>

Enabled Nextcloud:

  • a2ensite nextcloud.conf
  • a2enmod rewrite
  • systemctl reload apache2
  • reboot

When I connect to the expected site (/Nextcloud which worked before), I got the following:

I have tried this both on my physical host and directly on the VM. In both cases Apache works, it’s just the /Nextcloud link that doesn’t.

James

In the new config you posted, you’re doing a VirtualHost-based install so there should be no sub-directory specified in the URL.

Are you saying just the base IP address? That just gives me the Apache home page.

James

This or whatever you’re adding into your DNS:

No, nothing added into my DNS and my server name in the file is in my workgroup.

Should the server name be the same as the virtual server?

Being brutally honest, I’m unsure why that should affect anything if I’m using the VMs IP address.

James

Two things come to mind that you could try:

  1. Remove the backslash from <VirtualHost \*:80>.

  2. As far as I know, when using name-based virtual hosts, Apache looks for a matching ServerName or ServerAlias directive. If it doesn’t find a matching one, which is the case when you’re connecting via IP address, it falls back to the first virtual host in the configuration. On a default Debian installation, this is usually 000-default.conf.

    So make sure that the default virtual host is either disabled using

    a2dissite 000-default.conf
    

    or that you’re actually accessing the site via the hostname configured in ServerName rather than by IP address.

    Alternatively (although I’m not 100% sure whether this would actually work), you could try setting ServerName to the IP address or adding the IP address as a ServerAlias. Obviously, this would only work for a single virtual host unless your server has multiple IP addresses. So if you’re hosting multiple sites or services on that server and want to access them via IP address, you’d have to use subdirectories rather than separate virtual hosts.

It’s not the VM. Nextcloud runs fine in a VM.

From my own experience, accessing any web or Nextcloud servers via IP is PITA. Do you have a local DNS server? You should access your Nextcloud instance using a valid domain and yes that should match the name of the virtual host in Apache otherwise Apache will serve you the default home page.

When you access your server via its IP address then Apache will default to the um… default Apache home page. Apache expects a domain name that matches the name of the virtual host.

You may be able to work around this if you reconfigure Apache and disable the default home page or point it to your Nextcloud directory (not even sure if that’s possible) but it’s a dirty solution. Having a DNS and proper domain name is the right way.

This is required if you want to host multiple services on the same machine: mine is a NAS, a web server with two sites and a Nextcloud server, all accessed via different URLs. Even if you’re just testing NC in a VM it’s better to do this the right way so you get used to it.

If you don’t have a local DNS then you may try adding the Nextcloud domain and IP address to your hosts file.

UPDATE: I’ve finally got Nextcloud (my ultimate aim in all this) working on my mini-PC using Docker Desktop and Nextcloud AIO… just need to figure out how to back the install up now.

NOTE: I’m aware that DD for Win is being “deprecated” and “the service” is going in December although I’m unsure how that will affect a local installation.

Thanks for all the help :slight_smile:

James