Nextcloud, Traefik and Cloudflare

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 18.0.3.0
Operating system and version (eg, Ubuntu 17.04): Open Media Vault 5.3.10-1 (Usul) running on Linux 5.4.0-0.bpo.4-amd64
Apache or nginx version (eg, Apache 2.4.25): No idea, running in Docker
PHP version (eg, 7.1): No idea, running in Docker

Dear everyone!

A quick question here, I hope i’m in the correct section of the forum.
I installed Nextcloud two days ago on my OMV server at home, in order to share files with some of my clients.

All installations are made through portainer/docker.

So everything is working fine and I can set my the port forwarding on my router to head straight to Nextcloud while ports 80 and 443.
But I want to use Traefik with Cloudflare in order to redirect different subdomains to different apps on my servers, therefor have the nextcloud.domain.com heading to my Nextcloud.

In order to do so, I need to setup ports 80 and 443 on my router as assigned to Traefik and not to Nextcloud.

When I do so, my cloudflare subdomain (nextcloud.domain.com) gives a 502 error…

Is there a way to run both at the same time ?

Is this the first time you’ve seen this error? (Y/N): YES

Steps to replicate it:

  1. Install Nextcloud, assign ports 80 & 443
  2. Install Traefik, assign ports 79 & 442
  3. Router setting internal 79 for ext. 80, and same for 442:443.
  4. Link a domain to cloudflare
  5. Assign subdomain “nextcloud” as a CNAME redirection to @ (A entry being your home server’s IP).

The output of your Nextcloud log in Admin > Logging:

Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: Could not open file		2020-04-16T22:47:31+0200
Error	index	OCP\Files\NotFoundException: File does not exist		2020-04-16T22:46:24+0200
Error	PHP	stat(): stat failed for /data/nextcloud/data/appdata_ocgsar3cff99/css/icons/icons-list.template at /data/nextcloud/lib/private/Files/Storage/Local.php#144		2020-04-16T22:46:24+0200
Error	PHP	file_get_contents(/data/nextcloud/data/appdata_ocgsar3cff99/css/icons/icons-list.template): failed to open stream: No such file or directory at /data/nextcloud/lib/private/Files/Storage/Local.php#218		2020-04-16T22:46:24+0200
Error	PHP	unlink(/data/nextcloud/data/appdata_ocgsar3cff99/css/core/1090-be2e-results.css.gzip): No such file or directory at /data/nextcloud/lib/private/Files/Storage/Local.php#229		2020-04-16T22:46:09+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T22:46:08+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T22:46:08+0200
Error	index	OCP\Files\NotFoundException: File does not exist		2020-04-16T22:45:22+0200
Error	PHP	stat(): stat failed for /data/nextcloud/data/appdata_ocgsar3cff99/css/icons/icons-list.template at /data/nextcloud/lib/private/Files/Storage/Local.php#144		2020-04-16T22:45:22+0200
Error	PHP	file_get_contents(/data/nextcloud/data/appdata_ocgsar3cff99/css/icons/icons-list.template): failed to open stream: No such file or directory at /data/nextcloud/lib/private/Files/Storage/Local.php#218		2020-04-16T22:45:22+0200
Error	PHP	imagedestroy() expects parameter 1 to be resource, null given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#296		2020-04-16T22:03:33+0200
Error	PHP	imagejpeg() expects parameter 1 to be resource, null given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#295		2020-04-16T22:03:33+0200
Error	PHP	imageinterlace() expects parameter 1 to be resource, null given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#294		2020-04-16T22:03:33+0200
Error	PHP	imagescale() expects parameter 1 to be resource, bool given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#292		2020-04-16T22:03:33+0200
Error	PHP	Division by zero at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#291		2020-04-16T22:03:33+0200
Error	PHP	imagesx() expects parameter 1 to be resource, bool given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#291		2020-04-16T22:03:33+0200
Error	PHP	imagesy() expects parameter 1 to be resource, bool given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#291		2020-04-16T22:03:33+0200
Error	PHP	imagesx() expects parameter 1 to be resource, bool given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#290		2020-04-16T22:03:33+0200
Error	PHP	imagesx() expects parameter 1 to be resource, bool given at /data/nextcloud/apps/theming/lib/Controller/ThemingController.php#290		2020-04-16T22:03:33+0200
Warning	appstoreFetcher	Could not connect to appstore: cURL error 28: Operation timed out after 10000 milliseconds with 3440640 out of 4688957 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)		2020-04-16T17:30:12+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:12:07+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:12:07+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:11:20+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:11:20+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:10:34+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:10:34+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:09:48+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:09:48+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:09:02+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:09:02+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:07:19+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:07:19+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:06:33+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:06:33+0200
Error	cssresourceloader	Could not find resource css/server.css to load		2020-04-16T17:05:46+0200
Warning	core	Failed to compile and/or save /data/nextcloud/core/css/server.scss		2020-04-16T17:05:46+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T16:11:33+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T16:11:33+0200
Error	index	RedisException: NOAUTH Authentication required.		2020-04-16T16:11:33+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T16:11:33+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T16:11:33+0200
Error	index	RedisException: NOAUTH Authentication required.		2020-04-16T16:11:33+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T13:16:25+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T13:16:25+0200
Error	index	RedisException: NOAUTH Authentication required.		2020-04-16T13:16:25+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T13:16:25+0200
Error	core	RedisException: NOAUTH Authentication required.		2020-04-16T13:16:25+0200
Error	index	RedisException: NOAUTH Authentication required.		2020-04-16T13:16:25+0200
Error	core	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `permissions`, `checksum`, `metadata_etag`, `creation_time`, `upload_time` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` WHERE (`storage` = ?) AND (`path_hash` = ?)' with params [2, "563fc43a5e8144d219254be343eecaf0"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away		2020-04-16T11:03:13+0200
Error	core	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `uid`, `password` FROM `oc_users` WHERE `uid_lower` = ?' with params ["ncp"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away		2020-04-16T11:03:13+0200
Error	index	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `uid`, `password` FROM `oc_users` WHERE `uid_lower` = ?' with params ["ncp"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away		2020-04-16T11:03:13+0200
Warning	core	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `key`, `value`, `mount_id` FROM `oc_external_options` WHERE `mount_id` IN (?, ?, ?, ?, ?)' with params ["1", "2", "3", "4", "5"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away		2020-04-16T11:03:13+0200
Error	PHP	Error while sending QUERY packet. PID=85 at /data/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#117		2020-04-16T11:03:13+0200
Error	files	Icewind\SMB\Exception\Exception: Unknown error (103) for /A_ARCHIVES%20HDD%20MAUD/documents_ordinateur_fichier%20client_180304/clients/Julien_Le%20Dessert/Le_Dessert_190314/E_Le_Dessert_Menu/Dossier_Menu_LeDessert_181016/Links/logo%20chantilly%20seul.ai		2020-04-15T17:57:33+0200
Warning	no app in context	Login failed: ncp (Remote IP: 92.184.105.108)		2020-04-15T17:47:08+0200
Error	no app in context	Sabre\DAV\Exception\BadRequest: VCard object with uid already exists in this addressbook collection.		2020-04-15T17:31:22+0200
Error	cron	Exception: Not installed		2020-04-15T17:15:01+0200

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

<?php
$CONFIG = array (
  'passwordsalt' => 'mypassword',
  'secret' => 'mysecret',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '172.21.0.2',
    2 => 'nextcloudpi.local',
    3 => 'nextcloudpi',
    4 => 'nextcloudpi.lan',
    5 => '192.168.1.62',
    6 => 'my static IP adress',
    9 => 'nextcloud.mydomain.agency',
  ),
  'datadirectory' => '/data/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.3.0',
  'overwrite.cli.url' => 'https://nextcloud.mydomain.agency/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'this is my db user name',
  'dbpassword' => 'this is my db password and I wont share it, but I still appreciate you',
  'installed' => true,
  'instanceid' => 'ocgsar3cff99',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'pshhhhhhht this is a password again',
  ),
  'tempdirectory' => '/var/www/nextcloud/data/tmp',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'this works',
  'mail_domain' => 'this works too',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'name@mydomain.fr',
  'mail_smtppassword' => 'that is a super cool password involving the name of my dog in binary',
  'maintenance' => false,
);

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

Don't have access to this

Thank you !!!

Jonathan

1 Like