Skip to main content
WebsiteGitHub last commitGitHub commit activityGitHub IssuesDocker PullsDiscordLocalized

Nextcloud

Troubleshooting for Nextcloud

Access through untrusted Domain

This happens when you attempt to access nextcloud from a source not listed inside the config.php file.

NC Untrusted Domain

Changing directories

First we need to change our directory to where nextcloud is installed

In this example, nextclouds webroot is located at /var/docker/nextcloud/nextcloud/

cd /var/docker/nextcloud/nextcloud
info

cd stands for Change Directory

If you are in the right spot then you will see

3rdparty apps config cron.php dist lib ocs package.json resources themes
AUTHORS composer.json console.php custom_apps index.html nextcloud-init-sync.lock ocs-provider public.php robots.txt version.php
COPYING composer.lock core data index.php occ package-lock.json remote.php status.php

Editing the config.php file

Now lets edit the config.php file using nano

nano config/config.php

Scroll down until you see

'trusted_domains' =>
array (
0 => '',
),

Adding your domain to config.php

Now add your domain to the array

'trusted_domains' =>
array (
0 => 'cloud.bankai-tech.com',
),

If you need to add multiple domains you can do so like this

'trusted_domains' =>
array (
0 => 'cloud.bankai-tech.com',
1 => '192.168.4.130',
),

Now save the file and you should be able to access nextcloud now

tip

Save the file by pressing CTRL+X

note

If the error doesnt go away, you may need to clear your browser cache and restart the browser

The database is missing some indexes.

Missing Indexes

This seems to be caused by nextcloud skipping large indexes. To fix in a Docker environment, run the following.

sudo docker exec -it -u 33 nextcloud php occ db:add-missing-indices

Upstream Timed Out Error on Large File Uploads/Downloads

If you encounter this error when uploading or downloading large files:

[error] 412#412: *464 upstream timed out (110: Operation timed out) while reading response header from upstream

This error typically occurs when Nginx times out while waiting for a response from the PHP-FPM upstream when handling large files. The solution is to disable the content length header in Nextcloud's configuration.

Editing the config.php file

Navigate to your Nextcloud installation directory and edit the config.php file:

cd /opt/docker/nextcloud/nextcloud
nano config/config.php

Add the following line to your config array:

'set_time_limit' => 3600,
'set_header_content_length' => false,
info

The 'set_header_content_length' => false, setting prevents Nextcloud from setting the Content-Length header, which can cause issues with large file transfers through reverse proxies.

After adding this configuration, save the file and restart your Nextcloud container:

sudo docker restart nextcloud
tip

If you continue to experience issues, you may also need to increase timeout values in your Nginx configuration:

  • proxy_read_timeout
  • proxy_connect_timeout
  • proxy_send_timeout

Example Files

Config.php

<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'redis',
'password' => '',
'port' => 6379,
),
'trusted_proxies' =>
array (
0 => '192.168.4.204',
),
'forwarded-for-headers' =>
array (
0 => 'HTTP_X_FORWARDED_FOR',
),
'upgrade.disable-web' => true,
'instanceid' => '**REDACTED**',
'passwordsalt' => '**REDACTED**',
'secret' => '**REDACTED**',
'trusted_domains' =>
array (
0 => 'cloud.bankai-tech.com',
1 => '192.168.4.130',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'mysql',
'version' => '30.0.2.2',
'dbname' => 'nextcloud',
'dbhost' => 'mariadb',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => 'CHANGEME',
'installed' => true,
'maintenance_window_start' => 1,
'default_phone_region' => 'US',
'overwriteprotocol' => 'https',
'overwrite.cli.url' => 'https://cloud.bankai-tech.com',
'loglevel' => 2,
);

Clearing the Logs

Nextcloud

sudo docker exec -it <container_name> truncate data/nextcloud.log -s 0 && sudo docker restart <container_name>

Nextcloud AIO

sudo docker exec -it nextcloud-aio-nextcloud truncate data/nextcloud.log -s 0 && sudo docker restart nextcloud-aio-nextcloud

Resources

Buy me a beer

Changelog

Add troubleshooting section for upstream timeout errors during large file uploads/downloads in Nextcloud


💬 Discord Community Chat

Join the conversation! Comments here sync with our Discord community.

💬 Recent Comments

Loading comments...