Nextcloud is slow / long loading times

Hi,

my nextcloud is very slow and it takes several seconds for nextcloud to load/reload.
The nextcloud is running at my homeserver in a nixos vm and is behind a nginx reverse proxy (vserver).
Are there some options i can set to make the nextcloud faster?

My config:

{ pkgs,lib, ... }:
{
  services.nextcloud = {
    enable = true;
    hostName = "nextcloud";
    datadir = "/mnt/nextcloud";
    maxUploadSize = "5G";
    https = true; 
    autoUpdateApps.enable = true;
    config = {
      dbtype = "pgsql";
      extraTrustedDomains = ["192.168.1.232""192.168.9.3""nextcloud.domain.com"];
      trustedProxies = ["192.168.9.3"];
      defaultPhoneRegion = "DE";
      dbuser = "nextcloud";
      dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
      dbname = "nextcloud";
      adminpassFile = "/var/nextcloud-admin-pass";
      adminuser = "root";
    };
   phpOptions = lib.mkOptionDefault {
        "memory_limit" = "1G"; # required by face recognition app
        "opcache.jit" = "tracing";
        "opcache.jit_buffer_size" = "100M";
     };  
};

  services.postgresql = {
    enable = true;
    ensureDatabases = [ "nextcloud" ];
    ensureUsers = [
     { name = "nextcloud";
       ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
     }
    ];
  };

  # ensure that postgres is running *before* running the setup
  systemd.services."nextcloud-setup" = {
    requires = ["postgresql.service"];
    after = ["postgresql.service"];
  };
services.nginx.virtualHosts."nextcloud".listen = [ { addr = "0.0.0.0"; port = 8080; } ];
}

A few suggestions:

    caching = {
      redis = true;
      apcu = false;
    };
    extraOptions = {
      redis = {
        host = "localhost";
        port = 6379;
      };
      memcache = {
        local = "\\OC\\Memcache\\Redis";
        distributed = "\\OC\\Memcache\\Redis";
        locking = "\\OC\\Memcache\\Redis";
      };
    };
  • Tweak phpfpm for more performance in services.nextcloud.poolSettings, see for instance An Introduction to PHP-FPM Tuning – Tideways (but be careful: if you’re too generous with the pm.* settings here, you may end up with php-fpm OOMing)
1 Like