Nextcloud snap behind synology reverse proxy

Hello,

I am facing an issue since several days without solving it.

I installed Nextcloud through snap on an ubuntu server 20.04 which is itself a VM on Proxmox.

The installation went right and I can access to Nextcloud through the local IP.

Then I setup a reverse proxy on Synology having in mind that I have a dedicated subdomain on a registrar and a lets encrypt certificate associated to it on Synology (specific certificate, not the generic one provided by Synology).

I already setup such a reverse proxy for Jeedom and Onlyoffice and it works.

But for Nextcloud … it doesn’t work.

I joined the config.php file. I supposed some configuration has to be added to have Nextcloud accessible from outside.

<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'instanceid' => 'oc4f5wub71bv',
  'passwordsalt' => 'xxxxx',
  'secret' => 'yyyyy',
  'trusted_domains' =>
  array (
    0 => '192.168.0.55',
    1 => 'nextcloud.mydomain.fr',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.3.2',
  'overwrite.cli.url' => 'http://192.168.0.55',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'myDBpassword',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.mailprovider.fr',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'mySMTPname',
  'mail_smtppassword' => 'mySMTPpassword',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'mymailaddress',
  'mail_domain' => 'mymailprovider',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
);

If someone could help me it would be fine. Thank you.

Regards,

Rafael

Hello again,

I think I have solved the issue but dont know if it is the best way.

So previously, I have a reverse proxy installed on my synology redirecting https://nextcloud.mydomain.fr (port 443) to local IP http://mylocalIP (port 80) and it doesn’t work. I have a lets Encrypt certificate attached to nextcloud.mydomain.fr and installed in the synology.

A few minutes ago, I installed a self-signed certificate on the server hosting Nexcloud and I modify the reverse proxy.

Now I am redirecting https://nextcloud.mydomain.fr (port 443) to local IP https://mylocalIP (port 443) … and it works !!!

So if you know why it previously doesn’t work (maybe the port 80 ?), I will be happy to hear from you. It works with other applications self-hosted so …

Regards,

Rafael

Not a snap user, so just my 2cts
You cannot have http request on a https port, afaik. Check webserver log to confirm.

This (can be) is usually done by having a rewrite rule, changing http request into https.
the server can listen to both ports but rewrite al http on 80 to https on 443.