NextCloud Slow in public ip and work perfectly in lan

NextCloud Slow in public ip and work perfectly in lan
CPU: 8
RAM:16
Disk: 200Go (SSD)
Ubuntu20.04
Nextcloud 20.0.6
And these my config file :

<?php
$CONFIG = array (
  'passwordsalt' => 'Bi+RK3Uc4uziIOy8Ybt37F90pwdGxy',
  'secret' => 'oygqthcfrDDs1MwdnIFqJw7xDAmM4Xt+51kNQ4ctPBBP5pJD',
  'trusted_domains' =>
  array (
    0 => '**public ip**',
    1 => 'nextcloud.xxx.xx',
    2 => '**private ip**',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '20.0.4.0',
  'overwrite.cli.url' => 'https://nextcloud.meninx.tn/',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncadmin',
  'dbpassword' => 'px*pzAFjFtUYS0R2x7zf*@sNa3zs',
  'installed' => true,
  'instanceid' => 'occkydpk649s',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'mail_smtpmode' => 'smtp',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => 'true',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 0,
    'password' => '9hMPUKxOMpFc7o2tVDULNURlL',
  ),
  'logtimezone' => 'Africa/Tunis',
  'htaccess.RewriteBase' => '/',
  'maintenance' => false,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
);

It’s difficult to say so generally. Is it slow like “unusable slow”? Or is it just “slower” than in your LAN? Beacause to some extent this is normal.

The performance outside of your LAN mainly depends on the upload speed your ISP offers you. The second important factor is of course the speed of the internet connection from which you access your Nextcloud (e.g. cellular network, WiFi, office network…) Other factors could be DNS, your router etc…

1 Like

Hello , it is slow like unusable slow .
Here is my internet speed

1 Like

Is it slow with the external ip from your internal network or from every networks in the internet? Test access from mobile network or ask your friends.

If first point search NAT Loopback and Hairpinning

Your picture shows only the download speed of your internet connection. Relevant for external access is the upload speed. If you click on “show more info”, then you can see the Upload speed at the bottom on the right side. Or use https://www.speedtest.net. It’s more accurate imho.

image

Ok Maybe it is not more accurate in this case. Download speed seems a little low on this. Anyways… :wink:

Asuming that that this is your connection at home or wherever your Nextcloud server resides, 20mps is not a superfast connection but it should be more than good enough to make your Nextcloud usable from outside your network. At least the login page loads reasonable fast for me. (btw. you left all your realworld data in the config details you posted incl. database passwords etc.).

I think we need more info about your router config, network setup etc… And myabe you could describe “unusable slow” in a little more details, like how many seconds pass if you click on something and how you access your nextloud when you are outside of your network. I think the problem is either the connection from where you try to access your server or maybe your router/firewall…

1 Like
  • ssh access to the VM (nextcloud) is ok there are no slowness

  • Accessing to web login interface directly with NAT ip (everything is ok)

  • redirect the domain name in my hostfile (NAT-IP nexcloud.example.com)

  • is too slow (more than 3 min to display login web interface)

  • and the same with publique IP

redirect the domain name in my hostfile (NAT-IP nexcloud.example.com)
is too slow (more than 3 min to display login web interface)

Are you sure it uses the entry in your hosts file? You can test that by enter nslookup nextcloud.yourdomain.com in the command promt of your computer.

and the same with publique IP

How do you test that? Are you actualy outside your network, when you try to access your Nextcloud via public IP?

Hello, i found the root cause of slowness, it was "Collabora Online - Built-in CODE Server "
I disabled the module and every thing goes ok.
But is there any solution for that?

1 Like

Hard to say, could be the webserver/reverse proxy configuration, could be your router. Some routers have bad performance with NAT-Loopback. Did you add both domains (nextcloud and collabora) to your hosts file with the internal IP? I still think that your browser maybe not uses the hosts file or the entries in the hosts file maybe don’t work. Make sure that your browser uses the DNS/Proxy-Settings of your system and not some external DNS or DNS over HTTPS or something like that. Did you test the hosts file entries with nslookup? Other than that I begin to run out of ideas…

In my hosts windows file i added new entry (192.168.x.x nextcloud.example.com)

Ping, nslookup all it is ok (and all are inlocal network)

Every thing was perfectly with https://192.168.x.x/login

But very slow with https://nextcloud.example.com/login

As explained in my last reply the root cause is Collabora Online module

Is that possible to replace Collabora Online with an other module and check again?

1 Like
2 Likes

Can confirm, I had same issue and disabling "Collabora Online - Built-in CODE Server " server works normally now.

1 Like

I have the exact same issue. Nextcloud is slow in DNS but works great using IP.

Nextcloud: 24.0.0.12
CPU(s): 8
Ram: 8 GB
Disk: 500 GB SSD (more than 25% free space)
Description: Ubuntu 22.04 LTS

As other solution has indicated, disabling “Collabora Online - Built-in CODE Server” has helped, but in my case, I don’t think I have Collabora Online - Built-in CODE Server installed (at least not in the installed apps section).

Any help would be greatly appreciated.

If this happens inside your local network, it’s most likely due to your router badly handling NAT loopback / hairpin NAT.

If it is happening from outside the local network, I would have to ask how and from where you tested it and how slow it really is. I mean 10mbps upload is not super fast and you will definitely always notice a difference compared to a LAN connection. But it also depends on the speed of the internet connection you are connecting from. A crowded company / hotel / public WiFi or bad cell reception can of course also slow things down.

1 Like

Thanks for the response.

I haven’t tested this outside my home network, but I will test it and see if this issue is only within my network.
One follow-up question though - When I mentioned that it’s slow, I mainly was referring to opening the photos and pages (not uploading them to the nextcloud). Do you think a slow upload connection would be a constraint here?

From inside your LAN, no. But if NAT-reflection is beeing used, the IP address of every packet has to be re-written to the routers public IP address, which of course costs the router CPU time. Generally spekaing NAT-Reflection / Hairpinning is kind of a “hack” and should be avoided if performance is a concern.

From outside your LAN, probably yes. Files always need to be downloaded to view or edit them. And if you’re outside your loacal network these downloads will be limited by the upload speed of your home internet connection. So how significant the constraint will be depends mainly on the size of the files you are working with.

I signed up - JUST to respond to this thread because it helped me!

I had this same problem where it connected slow via WAN (when i say slow, i mean, it would take 3-4 MINUTES just to load the login page)- tried different ports, different NICs, routes, Port forwards, Inside/outside DMZ with no luck. I set up another server for another person and had the same issue (DSL, over cable, now) either it was my process, or something is wrong with the system.

i found this article and (painstakingly, via WAN) i turned off the CODE server and VOILA! OH. My. GOD YES! It is still a bit slow, but i believe that to be due to their slow upstream but it ACTUALLY works.

my process -

  • LAN speeds no issues (loads no different than this website we’re on right now)
  • via fqdn slow (with or without https)
  • via ip address had same speed issue
  • combination of with/without FQDN and only WAN, same issue
  • combination of only WAN and no LAN, same issue
  • turned off CODE server and it immediately resolved it (once the command completed)

edit: fqdn still a bit slow but not nearly AS slow. WAN IP works flawless.

3 Likes

Just also signed up to confirm I had the exact same problem and disabling CODE server also worked… a little sad. Can NC team look into that? thanks