Download takes a long time to start, but download speed is then very fast

@nxcl – Sorry, this complete thread is too long and the IMHO somewhat contradictory steps far too confusing for my pour old brain.

Just guessing in the dark:

Please understand I do not blame you and just lending a helping hand basically. IMHO from learning of the many in-official or vague sources of some advice above you could be in some serious trouble, unfortunately.

This is the home user forum and although you may ask freely and virtually anything, it may depend what you get answered for free. Any enterprise should ref. to Nextcloud GmbH as there shall be professional support available:

  1. Customers and Partners (mainly) closed portal —
  2. An Enterprise Subscription from Nextcloud is available with email and phone support.

NOTE: Please be aware I am not affiliated with Nextcloud GmbH and my views are the free views as both a volunteer and a EU citizen and appear in a private capacity solely.

Good luck.

I think, i did
sudo apt-get purge 'php*'

How do i test this correctly?



do I have to give www-data permission here?

I installed Redis like here:

@nxcl – You are in trouble and you may have lost your data or may lose it inadvertently. Honestly, this way of procedure was not exactly brilliant.

Warning: You may lose all of your data (inluding the data of presumed customers) if you have no backup. :warning:

Please make a full backup of both the database and the nextcloud/data file tree onto an external volume. Afterwards detach this volume from your computer and put this backup volume in a secure and safe place.

IMHO your team seems to be completely in the dark. If you are a business and if you truly have employees please get somebody professional to assist you at your earliest convenience.

Unfortunately, you did not although your statement is correct. Apparently, you did not only ‘purge’ the php-fpm module but instead you may have removed any and all PHP modules and thus the complete PHP software package including all configuration files from your system.

  • Please recall the phrase ‘remove’ but not ‘purge’ was used by me above.
  • Please be aware that the wildcard operator php* addresses any and almost all PHP modules on your system.
  • Please consult the CLI manual for the apt command by help of the CLI i.e. just make a man apt and look for the entries of ‘remove’ and ‘purge’ please.
  • Please consider the grave error you may have made and you may have destroyed your PHP configuration completely and utterly lost any chance of safe return inadvertently.

Please think first, act second only and always have the protection of your data in mind.

BTW a kind gesture like problem solved (i.e. :white_check_mark:) or a little ACK to one or more of my comments (i.e. click on the heart icon :heart:) would show you are satisfied. This could be a kind gesture and would motivate me like authors of other advice to continue in lending a hand freely…

Please immediately start studying the basics and in your own best interest consult the documentation:

Take your time to study and make some trials in a safe environment. Consider to install a test system, if you have a spare machine at hand and you can afford the time.

Stick to the more known Un*x flavours. Naturally, you can choose Ubuntu, CentOS, FreeBSD, ArchLinux and probably NextCloudPi or other flavours besides Debian Linux. Also available are some other OS …

As I am in a good mood today and lending a hand please find an excerpt from the a.m. APT manpage:

Removing a package removes all packaged data, but leaves usually small (modified) user configuration files behind, in case the remove was an accident. Just issuing an installation request for the accidentally removed package will restore its function as before in that case. On the other hand you can get rid of these leftovers by calling purge even on already removed packages. Note that this does not affect any data or configuration stored in your home directory.


Happy hacking.

We are still testing Nextcloud with pilot users only.
We also use the cloud exclusively for temporary file exchange with external users. Accordingly, we don’t make a real backup of the data, which is also communicated to the employees. We delete all uploaded files automatically after 30 days anyway. A loss of data is therefore relatively unimportant.

I’m new to the world of Linux.
I already noticed my mistake myself. Well, too late.

1 Like

Good to know and I rest my case. Your approach is a good one and I may have misunderstood some of your a.m. phrasings, apparently.

Furthermore, one could consult the Nextcloud Community Guidelines

Be pragmatic

Nextcloud is a pragmatic community. We value tangible results over having the last word in a discussion. We defend our core values like freedom and respectful collaboration, but we don’t let arguments about minor issues get in the way of achieving more important results. We are open to suggestions and welcome solutions regardless of their origin. When in doubt support a solution which helps getting things done over one which has theoretical merits, but isn’t being worked on. Use the tools and methods which help getting the job done. Let decisions be taken by those who do the work.

Better safe than ugly.

Good luck.

Unfortunately, the problem is still there.

I have executed the fatal command “sudo apt-get purge ‘php*’” before, when I was doing something else because of PHP.
I’m not really sure if this caused my problem - but I know that I didn’t have my above problem at the beginning.

So I will reinstall my Nextcloud completely.

However, I have set up about 50 users locally, which I don’t like to rebuild. Better, I want to reinstall the Nextcloud over the weekend so that the users don’t notice anything about it. So they should be able to log back in on Monday with the same user. Also their documents should be available.

How can I do this?
I once looked for something - but unfortunately I don’t find a really good, up-to-date manual.
Do you know any instructions, at best self-tested?

Currently I have on my screen:

  • Database backup - HOW?
  • /var/nc_data is on separate drive
  • /var/www/html/nextcloud/config/config.php
  • /etc/apache2/sites-available/ -everything-
  • /etc/php/7.3/apache2/php.ini
  • /etc/fail2ban/jail.d/nextcloud.local

Basically it is only one command to do backup of DB:

But I believe this is not your problem. Your problem is that Apache2 eats a lot. e.g. for me Apache is very small part of CPU time, but php-fpm and mysql are.

I found here that mod_status could give you an overview of what is happens with apache2:

I would try also to use lsof to check what a hell they are doung, e.g. for you first screenshot:

lsof -p 1828 1756

Try to do clean php 7.3. install after you purge php*.

As long as you have the problem with a single user, giving access to about 50 users will make things worse and even more difficult to debug.
To clarify: the first problems you have is when you just access as a single user (not with many other using it at the same time)

A few ideas, I’d try out:

  • Put a large file in a folder and download it (without php or anything, just a static file), this way you can check your basic setup including the network
  • Did all of your cronjobs run properly (check the admin-page when the cronjob run successfully the last time)
  • Did you try to access via webdav directly? Check out with WinSCP/Cyberduck or something, if the access is faster (if it works, I’d look into the apps that are installed and used on the web-interface)
  • Disable not used stuff. I’d start with http2, and all additional apps (especially things like the preview and stuff that might do stuff in the background)
  • Check more logs, did you have a look at the Nextcloud log? Increase the loglevel, over 1 minute looks a bit like something is running into a timeout (could be like an old external storage, incorrect ipv6 setup, …)

It seems I have the same issue…
CPU at 100% while file is being loaded into memory before the download starts.
Takes ~50s before download starts of a 500Mb file.

Can’t find anything in config files which might have an impact… also thinking of reinstalling the whole thing.

I’m not sure I’m supposed to like it when other people have the same problem. After all, the problem becomes public and we might find a solution.

Well, I will reinstall my Nextcloud the days and report


Can it be a problem that the owner is root and not www-data on /usr/sbin/apache2 ?

Should not be the problem, because apache will start under root as service and via apache config you can set exact user and group. E.g.:


export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

or via Service configuration. It is common practice.

Besides you have flag r and x on apache2 for all users that makes it executable for all of them.

I now have a parallel installation with the backup of my data directory, my database and the Nextcloud directory.
But now I want to test it locally with HTTP.
I get to the web interface, my changed background image and logo etc. appears, but when I login I loop to the address /login?redirect_url=/apps/files/

What can cause that? There are umpteen threads without a solution.

  GNU nano 2.9.3                                          001-nextcloud.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/nextcloud

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

> <?php
> $CONFIG = array (
>   'instanceid' => 'oczjuk6egamp',
>   'passwordsalt' => 'xxx',
>   'secret' => 'xxx',
>   'trusted_domains' =>
>   array (
>     0 => '',
>   ),
>   'datadirectory' => '/var/nc_data',
>   'dbtype' => 'mysql',
>   'version' => '',
>   'overwriteprotocol' => '',
>   'overwrite.cli.url' => '',
>   'dbname' => 'nextcloud',
>   'dbhost' => 'localhost',
>   'dbport' => '',
>   'dbtableprefix' => 'oc_',
>   'mysql.utf8mb4' => true,
>   'dbuser' => 'nextcloud',
>   'dbpassword' => 'nextcloud',
>   'installed' => true,
>   'activity_expire_days' => 14,
>   '' => false,
>   'blacklisted_files' =>
>   array (
>     0 => '.htaccess',
>     1 => 'Thumbs.db',
>     2 => 'thumbs.db',
>   ),
>   'cron_log' => true,
>   'enable_previews' => true,
>   'enabledPreviewProviders' =>
>   array (
>     0 => 'OC\\Preview\\PNG',
>     1 => 'OC\\Preview\\JPEG',
>     2 => 'OC\\Preview\\GIF',
>     3 => 'OC\\Preview\\BMP',
>     4 => 'OC\\Preview\\XBitmap',
>     5 => 'OC\\Preview\\Movie',
>     6 => 'OC\\Preview\\PDF',
>     7 => 'OC\\Preview\\MP3',
>     8 => 'OC\\Preview\\TXT',
>     9 => 'OC\\Preview\\MarkDown',
>   ),
>    'filesystem_check_changes' => 0,
>   'filelocking.enabled' => 'true',
>   'htaccess.RewriteBase' => '/',
>   'integrity.check.disabled' => false,
>   'knowledgebaseenabled' => false,
>   'logfile' => '/var/nc_data/nextcloud.log',
>   'loglevel' => 2,
>   'logtimezone' => 'Europe/Berlin',
>   'log_rotate_size' => 104857600,
>   'maintenance' => false,
>   'memcache.local' => '\\OC\\Memcache\\Redis',
>   'memcache.locking' => '\\OC\\Memcache\\Redis',
>   'memcache.distributed' => '\\OC\\Memcache\\Redis',
>   'preview_max_x' => 2048,
>   'preview_max_y' => 2048,
>   'preview_max_scale_factor' => 2,
>   'redis' =>
>   array (
>     'host' => '/var/run/redis/redis-server.sock',
>     'port' => 0,
>     'timeout' => 0.0,
>   ),
>   'quota_include_external_storage' => false,
>   'share_folder' => '/Shares',
>   'theme' => '',
>   'trashbin_retention_obligation' => 'auto, 7',
>   '' => 'stable',
>   'mail_from_address' => 'admin',
>   'mail_smtpmode' => 'smtp',
>   'mail_sendmailmode' => 'smtp',
>   'mail_domain' => 'xxx',
>   'mail_smtphost' => 'xxx',
>   'mail_smtpport' => '465',
>   'mail_smtpauthtype' => 'LOGIN',
>   'mail_smtpauth' => 1,
>   'mail_smtpname' => 'xxx',
>   'mail_smtppassword' => 'xxx',
>   'mail_smtpsecure' => 'ssl',
>  'simpleSignUpLink.shown' => false,
>   'default_language' => 'en',
>   'app_install_overwrite' =>
>   array (
>     0 => 'groupfolders',
>   ),
> );


Could you please check nextcloud log and php log? If you search in Forum almost all issues comes with wrong permissions somewhere.

Regarding Doku your simple Apache Config is almost correct (there are some additional rules to directory):

<VirtualHost *:80>
  DocumentRoot /var/www/nextcloud/

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

    <IfModule mod_dav.c>
      Dav off


Try to set in config.php 'overwriteprotocol' => 'http', this could help.

Also it could be that you have to move from php-fpm to php and Change MPM from “event” to “prefork” if you used http2.0. Basically opposite site to what is written here:

P.S. Those 2 are sensible data, please remove it and do not post again.

Thanks for your help,

I have just adapted my Apache configuration to your suggestion and 'overwriteprotocol' => 'http' , I’ve tried before. Unfortunately, no improvement so far.

Also it could be that you have to move from php-fpm to php and Change MPM from “event” to “prefork” if you used http2.0. Basically opposite site to what is written here:

Honestly, I don’t really know what to do here.

When I try to log in, unfortunately no message appears in my Nextcloud Log.
The same in /var/log/php7.3-fpm.log

Are there any other logs which can help?

When I let Apache listen to :80 and have overwriteprotocol on ‘http’ and want to log in via http://, I am always redirected to /login?redirect_url=/apps/files/. Endless loop.

When i change overwriteprotocol to ‘https’ and want to log in via http://, I’m getting redirected to That looks better but without letting Apache listen on :443 this is going on error.

So, now i tried to create a simple apache config to let Apache listen on :443
But this isn’t working…
I created this: /etc/apache2/sites-available/001-nextcloud-le-ssl.conf
and did systemctl reload apache2 + service apache2 restart

Sure, there will be security warning in the browser but this would be ok for testing.

<IfModule mod_ssl.c>
<VirtualHost *:443>
  DocumentRoot /var/www/html/nextcloud/

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

    <IfModule mod_dav.c>
      Dav off



Got it to work with

and WTF the same problem with the new system!

I will erase my /nextcloud/config/config.php now to minium and try…

Does anyone have experience with the support directly from Nextcloud?
I don’t want enterprise support that costs a lot of money every year.
Basically a one-time support would be enough for me.

Does anyone know how and whether this is directly possible with Nextcloud?

My problem was the same as yours.

My Nextcloud setup is:
NC - 15.0.5
Mysql -15.1 Distrib 10.1.38-MariaDB
PHP - 7.3
Apache2 - 2.4.38-2

I have fixed it by modifying the line listed below:
“sudo nano /etc/apache2/conf-available/http2.conf”

-H2StreamMaxMemSize 5120000000
+H2StreamMaxMemSize 128000

Save the file and restart apache2 service:
“sudo systemctl restart apache2”

I have followed the installation guide from link below, which is not available anymore.

These links were helpfull for me:

I hope it will help you.


I had the same issue and this solved it for me!

I’m on nextcloud v20.