.htaccess or apache config problem?

I installed nextcloud on my Intel NUC and set up the firewall and was able to access it from the localhost but also from my local network. Then I must have changed something but I can’t remember what. Since then I am not able to access nextcloud from my local network. I can still access it from the machine it is installed on. I can access index.html file I have created in the parent folder though. Also I am getting entries in /var/log/apache2/access_log whenever I am trying to access nextcloud. Can’t remember changing .htaccess. I did change the php.ini file though. Any ideas where I can look for the problem?

Here is some information:

  • Operating system and version:
    • OpenSUSE 15.6
  • Web server and version:
    • Apache/2.4.58
  • PHP version :
    • 7.4.33

And my config.php

<?php
$CONFIG = array (
  'instanceid' => '----',
  'passwordsalt' => '---',
  'secret' => '----',
  'trusted_domains' => 
  array (
    0 => '192.168.1.99',
    1 => 'localhost',
  ),
  'datadirectory' => '/srv/www/htdocs/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '24.0.8.2',
  'overwrite.cli.url' => 'http://192.168.1.99/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouduser',
  'dbpassword' => 'xxxxx',
  'installed' => true,
  'loglevel' => 0,
  'theme' => '',
);

could this be your routers IP? generally an IP address is not a domain. see FQDN.

Setting trusted domains

Set trusted domains (iterating values 0, 1, 2…):

occ config:system:set trusted_domains 0 --value=cloud.yourdomain.xyz

Adding multiple trusted domains manually in config.php:

  • edit config.php

and add/edit section

 'trusted_domains' =>
  array (
    0 => 'cloud.yourdomain.xyz',
    1 => 'cloud.yourotherdomain.zxy',
    2 => 'localhost',
    3 => 'nextcloud.local',
  ),

Be aware that the values for trusted_domains should be domain names (see FQDN). IP addresses are not domains!

1 Like

Sorry, I wanted to change it and only inserted a 1.

So I added another line to the trusted_domains section of config.php and added that same name to the /etc/hosts on my machine and I can access it that way. Any idea why I can’t access it through the IP? It used to work that way

no worries, sh1t happens :clown_face:

so to be clear, your nextcloud is resolved properly with the correct address https://your.domain.tls and you are wondering why it can’t be accessed locally by entering the IP address.

well congratulations, your server is correctly configured :+1:

  • are you using a local DNS like Pihole or Adguard in your network?

    • if so, make your instance known to your local DNS, then you’ll be able to reach your instance locally with an IP address.
  • you don’t have a local DNS, but does the machine you’re trying to access the cloud from know that your instance is in your local network?

    • if not, try adding the instance IP address and domain to /etc/hosts on your machine. then it will resolve https://your.domain.tls locally first before asking DNS to resolve “the way it should”. this could cause issues in the long run though. DNS is tricky!

this is a DNS issue, its always DNS :grimacing: