NextCloud & NGinx : server reached pm.max_children setting (5), consider raising it

85 x served & 6 x viewed

J’ai eu l’erreur : « server reached pm.max_children setting (5), consider raising it » dans les fichiers de logs /var/log/php7.2-fpm.log.

Mes fichiers de logs pour Nextcloud ( configuration via NGinx ) :

– /var/log/php7.2-fpm.log : PHP .
– /var/log/nginx/nextcloud.error & /var/log/nginx/nextcloud.access : NGINX .
– /var/log/nextcloud.log : Nextcloud.
– /usr/share/nginx/nextcloud/data/nextcloud.log : Nextcloud.
– /usr/share/nginx/nextcloud/data/audit.log : Nextcloud.
– /usr/share/nginx/nextcloud/data/updater.log : Nextcloud.

Pour supprimer l’erreur j’ai modifié le fichier de configuration :

# cat /etc/php/7.2/fpm/pool.d/www.conf | grep -v "^;" | grep -v "^$"
[www]
user = www-data
group = www-data
listen = /run/php/php7.2-fpm.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 50 
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 10
env[PATH] = /usr/local/bin:/usr/bin:/bin

Je suis donc passé de 5 à 50 … je pense que le problème ne devrait plus apparaitre.

A noter aussi que j’ai modifié le système de cron afin que cela soit plus performant :

$ crontab -u www-data -l
*/5  *  *  *  * php -f /usr/share/nginx/nextcloud/cron.php

NextCloud : access forbidden by rule GET /data/.ocdata?t=

84 x served & 43 x viewed

Pour supprimer ce type d’erreur :

[error] 2239#2239: *454376 access forbidden by rule, client: 127.0.0.1, server: 127.0.0.1, request: "GET /data/.ocdata?t=1591823240128 HTTP/1.1", host: "127.0.0.1"

J’ai modifié la configuration de NGINX.
Sur les fichiers /etc/nginx/conf.d/nextcloud-local.conf & /etc/nginx/conf.d/nextcloud.conf . J’ai ajouté :

    location = /data/htaccesstest.txt {
    allow all;
    log_not_found off;
    access_log off;
    }
    location = /data/\.ocdata {
    access_log off;
    }

Pour relancer :

systemctl restart nginx.service

NextCloud sur Ubuntu : Installation de « Memory Caching »

89 x served & 14 x viewed

J’ai choisit de mettre dans le fichier de configuration : /usr/share/nginx/nextcloud/config/config.php

'memcache.local' => '\OC\Memcache\APCu',

Pour que cela fonctionne il faut installer la bonne librairie en PHP :

$ sudo apt-get install php-apcu
...
$ sudo systemctl restart php7.2-fpm.service

NextCloud : 504 Gateway Time-out ( Update en ligne de commande)

103 x served & 22 x viewed

Quand on a l’erreur « 504 Gateway Time-out’ … le mieux est de faire avec les lignes de commandes :

$ sudo -u www-data php /usr/share/nginx/nextcloud/updater/updater.phar
Nextcloud Updater - version: v16.0.3-3-ga0c2b25 dirty

Current version is 18.0.4.

Update to Nextcloud 18.0.4 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-18.0.4.zip
Open changelog ↗

Steps that will be executed:
[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Continue update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] Y
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
2020-06-01T19:21:53+02:00 Set log level to debug
....
$ sudo -u www-data php /usr/share/nginx/nextcloud/occ maintenance:mode --off
Maintenance mode disabled

NextCloud : Table ‘oc_external_mounts’ doesn’t exist

99 x served & 11 x viewed

J’ai eu l’erreur : Table ‘nextcloud.oc_external_mounts‘ doesn’t exist , pour fixer le problème j’ai fait :

Pour avoir l’erreur j’ai modifié le fichier /usr/share/nginx/nextcloud/config/config.php :

  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'debug' => true,
  'loglevel' => '2',
  'logtimezone' => 'Europe/Paris',
  'log_type' => 'owncloud',
  'logfile' => '/var/log/nextcloud.log',
  'log_rotate_size' => '104857600',

Pour le fix du problème :

$ sudo -u www-data php /usr/share/nginx/nextcloud/occ maintenance:repair
...
$ sudo -u www-data php /usr/share/nginx/nextcloud/occ upgrade
Nextcloud is already latest version
$ sudo -u www-data php /usr/share/nginx/nextcloud/occ  app:enable files_external
files_external enabled
$ sudo -u www-data php /usr/share/nginx/nextcloud/occ upgrade
Nextcloud is already latest version

A noter que j’ai aussi modifier la configuration de PHP : /etc/php/7.2/fpm/php.ini

[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
disable_classes =
zend.enable_gc = On
expose_php = Off
max_execution_time = 120
max_input_time = 120
memory_limit = 512M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 4024
ignore_repeated_errors = On
ignore_repeated_source = Off
report_memleaks = On
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 20M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60

J’ai vu cette erreur j’ai donc grandement augmenté la mémoire et le temps (Par défaut c’est 128M et j’ai mis 512M).

PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in 
/usr/share/nginx/nextcloud/lib/private/Log/LogDetails.php on line 99" while reading response header from upstream, 
client: 127.0.0.1, server: 127.0.0.1, request: "GET /cron.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "127.0.0.1"

Pour relancer le service : sudo systemctl restart php7.2-fpm.service .

A suivre.