Nextcloud Server Stuck Rendomly

Nextcloud version 21.0.1`
Operating system Ubuntu 20.04.1
Apache version 2.4.41
PHP version 7.4.3
Host Server-Windows 2019 Hyper-V

I’m facing a randomly stucking server, It took few minutes to get the login page even from the internal network. and sometimes I gate the login page, and then it works very very slow, and sometimes its stays on the same login page. anyway, the only thing that solves this problem is by doing reboot the server.

The output of your Nextcloud log in Admin > Logging:

Error: copy(/var/www/html/nextcloud/apps/twofactor_totp/twofactor_totp/vendor/rullzer/easytotp/tests/bootstrap.php): failed to open stream: No such file or directory at /var/www/html/nextcloud/lib/private/legacy/OC_Helper.php#151
Error: mkdir(): No such file or directory at /var/www/html/nextcloud/lib/private/legacy/OC_Helper.php#142

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

?php
$CONFIG = array (
  'instanceid' => 'ocvnq7bux4z6',
  'passwordsalt' => 'AS03zaE6sdBupwpnTnBOGfKFoeXg/s',
  'secret' => 'Vll/HtHTgML4Hq+GJbap4m5uep0jriJzz4Z9Kw6tTMw5w92U',
  'trusted_domains' =>
  array (
    0 => '192.168.1.215',
    1 => 'cloud.epstein.co.il',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'http://192.168.1.215/nextcloud',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud_user',
                               [

The output of your Apache/nginx/system log in /var/log/____:

[Wed May 19 00:00:06.373672 2021] [mpm_prefork:notice] [pid 865] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 00:00:06.373693 2021] [core:notice] [pid 865] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 06:28:15.688336 2021] [mpm_prefork:notice] [pid 865] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed May 19 06:28:15.728609 2021] [mpm_prefork:notice] [pid 865] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 06:28:15.728621 2021] [core:notice] [pid 865] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 06:28:29.996133 2021] [mpm_prefork:notice] [pid 865] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed May 19 06:28:30.031510 2021] [mpm_prefork:notice] [pid 865] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 06:28:30.031523 2021] [core:notice] [pid 865] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 13:55:17.810768 2021] [mpm_prefork:notice] [pid 865] AH00169: caught SIGTERM, shutting down
[Wed May 19 13:55:29.665665 2021] [mpm_prefork:notice] [pid 863] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 13:55:29.671847 2021] [core:notice] [pid 863] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 15:45:02.482755 2021] [mpm_prefork:notice] [pid 863] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed May 19 15:45:02.525795 2021] [mpm_prefork:notice] [pid 863] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 15:45:02.525844 2021] [core:notice] [pid 863] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 15:45:13.556597 2021] [mpm_prefork:notice] [pid 863] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed May 19 15:45:13.598299 2021] [mpm_prefork:notice] [pid 863] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 15:45:13.598312 2021] [core:notice] [pid 863] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 15:45:15.888840 2021] [mpm_prefork:notice] [pid 863] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed May 19 15:45:15.933700 2021] [mpm_prefork:notice] [pid 863] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 15:45:15.933709 2021] [core:notice] [pid 863] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 15:48:26.138948 2021] [mpm_prefork:notice] [pid 863] AH00169: caught SIGTERM, shutting down
[Wed May 19 15:48:37.808482 2021] [mpm_prefork:notice] [pid 862] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 15:48:37.808687 2021] [core:notice] [pid 862] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 15:58:21.418586 2021] [access_compat:error] [pid 1101] [client 192.168.1.231:64822] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Wed May 19 16:24:30.490147 2021] [mpm_prefork:notice] [pid 862] AH00169: caught SIGTERM, shutting down
[Wed May 19 16:24:40.037437 2021] [mpm_prefork:notice] [pid 883] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 16:24:40.038072 2021] [core:notice] [pid 883] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 16:35:52.356479 2021] [access_compat:error] [pid 1115] [client 192.168.1.231:49650] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Wed May 19 16:40:14.340380 2021] [mpm_prefork:notice] [pid 883] AH00169: caught SIGTERM, shutting down
[Wed May 19 16:40:23.278403 2021] [mpm_prefork:notice] [pid 858] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed May 19 16:40:23.287182 2021] [core:notice] [pid 858] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 19 17:07:39.269283 2021] [access_compat:error] [pid 1501] [client 192.168.1.10:51521] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Wed May 19 17:28:40.215339 2021] [access_compat:error] [pid 1549] [client 192.168.1.10:51824] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata

Hi @itzikd

More interesting in this context would actually be your Apache config. But I can’t exclude that several different problems are interfering here.

Regarding this error message…

…add a second line in the /etc/hosts file below the existing one with the following content:

127.0.1.1       cloud.yourdomain.com      cloud

Make sure it is the same name, wich is used in the ServerName Directive of your Apache configuration file. If you use a seperate VirtualHost.conf file for your Nextcloud, try to disable the 000-default.conf if you have not already done so… Reboot your server/VM after you did the changes.

Hi,
Thanks for your quick response.
I add this line to the hosts’ file and reboot the server.
I don’t see now any error on the Apache log.
do you think I should do some other setting or just wait a few days to see if it’s happened again?

Yes I would wait and see if it happens again. Maybe you could check the apache error log from time to time and see whether error messages appears again. But I think chances are good that the problem is solved. At first I wasn’t sure about the other error message. But it seems there is nothing to worry about that one, as long as everything works normal… Client denied by server configuration: .ocdata - #3 by danse

Great, I will keep following and update in the coming days.
Thanks