App very slow when Nextcloud server is in same subnet

Hey everyone,

Today I went ahead and migrated my ownCloud server to Nextcloud and I must say that I’m very impressed by it! It runs great and has quite a lot of featuers that were missing like the ability to move shared folders and better mobile apps.

Espacially the Android app has come a far way. But I am experiencing a problem that is very strange. I already found a workaround, but I would like to solve this issue completely.

The problem is that when I use the Android app everything loads really slowly. The loading bar keeps going for at least a full minute or longer. Thumbnails load very, very slowly and it’s hardly usable. Data transfer speeds seem fine although I didn’t test this for any files bigger than 4 MB. This only occurs when I’m connected to my own WiFi and not on mobile data or other hotspots.

The desktop apps are fine in any cases, except on my slow Asus Transformer tablet, but that’s to be expected with such low end specs and the target disk being an SD card.

My Nextcloud server is running on my local network on the IP adress This is a 64-bit Ubuntu 16.04.1 VM running on two CPU cores with 4GB of RAM and a 16GB SSD allocated from the VMware host. The data is stored on my Synology NAS using an NFS share with a RAID-5 volume on brand new disks.

The webserver on this VM is the latest version of apache2 and I’m using MySQL for the database. All of this is running on the same VM.

My apache config looks like this:

 <VirtualHost *:80>
    Redirect permanent /

<IfModule mod_ssl.c>
        <VirtualHost *:443>
                DocumentRoot /var/www/nextcloud
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile      /etc/apache2/ssl/
                SSLCertificateKeyFile /etc/apache2/ssl/
                SSLCertificateChainFile /etc/apache2/ssl/
                <IfModule mod_headers.c>
                        Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"

The Nextcloud config looks like this:

$CONFIG = array (
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    0 => '',
    1 => 'cloud.mydomain.local',
  'datadirectory' => '/mnt/nextcloud',
  'overwrite.cli.url' => '',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '***',
  'dbpassword' => '***',
  'logtimezone' => 'UTC',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_from_address' => 'administrator',
  'mail_domain' => '',
  'mail_smtphost' => '',
  'mail_smtpport' => '25',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'theme' => 'mytheme',
  'loglevel' => 2,

My DNS settings are set-up so that resolves to instead of my local IP. The DHCP leases inside the same subnet so there is no routing going on. However when I set my DNS to resolve to the public IP directly or use a different upstream DNS server like loading folders and generating thumbnails is almost instant!

Does anyone know how I can debug this problem or what’s causing it? I want to use local DNS so internal file transfers are not routed over my gateway, but for some reason it seems to have an inverted effect.

Hopefully someone can help me out. Thanks!

What you describe sounds good. So it’s not sure where the problem is but it would be good to have a look on the network level where the error could be (would be great to test the connections speed without Nextcloud and directly via IP without DNS). I don’t know Android and if there are any tools to do this. Could this be that all cable connections are fast and it only concerns wifi-connections?

Thanks for your reply. I don’t know how to perform these tests either, but on all PC’s everything is fine. It’s quite hard to debug mobile devices, so for the time being I’m using the DNS settings to point to my server over the internet.

WiFi itself is also fine for downloading, but it only gives problems when my DNS settings are set to my local server

So it seems that the problem is solved now but I have no idea why exactly.
It seems like a different website on my Ubuntu server was causing it indirectly (reverse proxy site on different domain).