Nextcloud as Dropbox Replacement - Can't access without home WiFi

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, 20.0.5): 22.1.1
Operating system and version (eg, Ubuntu 20.04): Docker Container on DS920+
Apache or nginx version (eg, Apache 2.4.25): unsure
PHP version (eg, 7.4): unsure

The issue you are facing:
I’m trying to run Nextcloud as a Dropbox replacement on my Synology Diskstation 920+ via a Docker container created in this manner (Synology: How to Install Nextcloud Using Docker – Marius Hosting). For the most part, it’s working exactly as I hoped, with one exception: I can’t access it if I’m not connected to my home WiFi (or behind a VPN). I know it has something to do with opening ports, however I’ve already opened ports 80, 443, and 5001 on my router (see attached). I’m hoping I can figure this out, because I really do love using Nextcloud, and any help would be appreciated.

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

Steps to replicate it:

  1. Disconnect from home WiFi
  2. Open Nextcloud
  3. Attempt to Access file

The output of your Nextcloud log in Admin > Logging:

Error	index	OCP\Files\NotFoundException: /Chas/files/Music	
2021-09-07T21:22:13-0400
Error	index	OCP\Files\NotFoundException: /Chas/files/Music	
2021-09-05T12:20:59-0400
Error	index	OCP\Files\NotFoundException: /Chas/files/Music	
2021-09-05T12:19:28-0400
Error	index	OCP\Files\NotFoundException: /Chas/files/Music	
2021-09-05T12:01:04-0400
Error	index	OCP\Files\NotFoundException: /Chas/files/Music	
2021-09-05T12:00:57-0400
Error	index	OCP\Files\NotFoundException: /Chas/files/Music	
2021-09-05T11:50:33-0400
Error	index	OCP\Files\NotFoundException: /Chas/files/Music	
2021-09-05T11:50:29-0400
Error	no app in context	OCP\Files\NotFoundException: /Chas/files/Music/Bruce Springsteen	
2021-09-05T11:48:40-0400
Error	no app in context	OCP\Files\NotFoundException: /Chas/files/Music/Bruce Springsteen	
2021-09-05T11:48:40-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 8824785 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 4138384 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#693	
2021-09-05T11:42:39-0400
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 8263041 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 2470288 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2021-09-05T11:42:39-0400
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 7399603 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 3611312 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2021-09-05T11:42:39-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:22:50-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:49-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:48-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:26-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:23-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:20-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:07-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:02-0400
Fatal	webdav	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction	
2021-09-05T11:21:01-0400
Warning	core	Renewing session token failed	
2021-09-04T08:45:41-0400
Warning	core	Login failed: 'cbelfield' (Remote IP: '172.21.0.1')	
2021-09-04T08:25:11-0400
Warning	core	Login failed: 'cbelfield' (Remote IP: '172.21.0.1')	
2021-09-04T08:25:06-0400
Warning	core	Login failed: 'cbelfield' (Remote IP: '172.21.0.1')	
2021-09-04T08:17:04-0400
Warning	core	Login failed: 'cbelfield' (Remote IP: '172.21.0.1')	
2021-09-04T08:17:02-0400
Warning	core	Login failed: 'cbelfield' (Remote IP: '172.21.0.1')	
2021-09-04T08:02:33-0400
Warning	core	Login failed: 'cbelfield' (Remote IP: '172.21.0.1')	
2021-09-04T08:02:31-0400
Error	no app in context	Swift_TransportException: Connection could not be established with host 127.0.0.1 :stream_socket_client(): Unable to connect to 127.0.0.1:25 (Connection refused)	
2021-09-04T08:01:57-0400
Warning	no app in context	Could not detect any host in https:///data/htaccesstest.txt	
2021-09-04T07:54:15-0400
Warning	no app in context	Could not detect any host in http:///data/htaccesstest.txt	
2021-09-04T07:54:15-0400
Warning	no app in context	Could not detect any host in https:///data/htaccesstest.txt	
2021-09-04T07:53:14-0400
Warning	no app in context	Could not detect any host in http:///data/htaccesstest.txt	
2021-09-04T07:53:14-0400

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

<?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,
    ),
  ),
  'instanceid' => 'ock0twio2c1l',
  'passwordsalt' => 'kUuJ5UUE2m6pfTxuud9jz+92njn9YW',
  'secret' => '1akB7AyyHC9/IcEsu4Gdq1c8KzA/wPXQ0fDuHg3uuqIfwyyC',
  'trusted_domains' => 
  array (
    0 => 'XXX.XXX.X.XX:XXXX',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '22.1.1.2',
  'overwrite.cli.url' => 'http://XXX.XXX.X.XX:XXXX',
  'dbname' => 'XXXX',
  'dbhost' => 'mariadb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXXX',
  'dbpassword' => 'XXXX',
  'installed' => true,
);

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

I'm afraid I don't understand what this is, or if it even exists in Docker (I'm new to that as well)

Might have come up with a workaround but of course that creates its own challenges. I think I can use Synology’s Reverse Proxy function to create an HTTPS URL that I can then access via the Internet. But the problem is, every time I try to add this URL as a trusted domain to config.php, it kills my ability to login (says the config folder has become “read only”) and I have to redeploy the entire stack. Can anyone help me figure out how to edit config.php?

I can not really find the attachment of your router. Have you set a port forwarding on your router from your outside ip/port to your Synology ip / port? Wich internet router do you use?

Or are the logs really from access through internet?

Sorry, guess I was trying to make sure I got all the requested details and forgot to upload the attachement. I think I’ve done all the port forwarding stuff on my Netgear C7000v2, however I am very new to all this; in the words of Michael Scott, please explain it to me like I’m 5. :grinning_face_with_smiling_eyes:
The logs came from the Nextcloud Dashboard - I don’t know what else to say about that.
Any idea how to edit config.php to implement the reverse proxy settings and use HTTPS without killing my entire Nextcloud?

Screenshot_20210915_155543