New nextcloud in WSL2 only reachable with localhost

Hi there,

I have been googling since hours but I can not find how to solve my problem…

Maybe you can help me…

I am on windows and installed ubuntu via wsl2 and on this I set up nextcloud. And at this computer I can get into nextcloud with localhost/nc. But I can not connect with typing 192.168.1.15/nc (Ip is the IP of computer with nextcloud).

Here is my /etc/apache2/sites-available/nextcloud.conf



	Alias /nc "/var/www/nextcloud/"

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

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

And here my /var/www/nextcloud/config/config.php

<?php
$CONFIG = array (
  'instanceid' => 'oc1t9tn739p9',
  'passwordsalt' => 'CYZrSW9jyZSps+bMVrtDS3M+A4s0if',
  'secret' => 'TAe4W73LYjEaD9Ms2aTKSH7d8vlvvF3osbWc/Zi/jUJTKyYT',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '192.168.1.*',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '29.0.3.4',
  'overwrite.cli.url' => 'http://192.168.1.15/nc',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'memories.db.triggers.fcu' => true,
  'memories.exiftool' => '/var/www/nextcloud/apps/memories/bin-ext/exiftool-amd64-glibc',
  'memories.vod.path' => '/var/www/nextcloud/apps/memories/bin-ext/go-vod-amd64',
  'htaccess.RewriteBase' => '/',
);

I tried with virtual server and ServerName and so on but nothing worked so far.

NC should be available only locally.

Any ideas?

Thanks

have you tried to write it as it is “192.168.1.15” in the trusted domain section?

The trusted domains is the list of url and/or ip addresses that your site is accessible from. So putting * into your trusted domains is basically saying that my nextcloud address can be reached from every address on my network. This of course cannot be true as your TV which has an address of lets say 192.168.1.200 does NOT host your nextcloud instance.
simply if the address of your windows pc/nextcloud server is 192.168.1.10 then this is the ip address that you put in your trusted domains list NOT 192.168.1.*
yep.

Good guess, but if it were trusted_domains they’d be able to reach Nextcloud still. They would just receive an error that they were connecting via an untrusted domain.

My best guess is this is more an OS networking issue or something related to the WSL2 stack since it’s Linux running on top of Windows. Or possibly the Apache config.

What occurs when you attempt this?

Hey,
thank you for all your answers and help.
I found out, it is because WSL2 has its own IP Addresses and I had to connect both IPs: Accessing network applications with WSL | Microsoft Learn

So, now it works.
I tried out to set trusted domains to …15 only. Then I get the info that I can not access from other PCs (with nextcloud-background), so I let …* and it works…

Thank you

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.