Imposible to connect in LAN

Hello fellows,

I have a snap nextcloud installed on an ODROID-H2+ running on an Ubuntu 20.04.1 LTS.
Initially I installed an SSL certificate with Let’s Encrypt.

This allowed me to use nextcloud inside my LAN via HTTP and through the internet via HTTPS.
However, I don’t want to have two instances of the connection in my android phone. I just want that the HTTPS connection via my DDNS is posible.

I added the DNS entry in my home router so that the DDNS host points to the nextcloud IP.

I can’t log in nextcloud via android app or via browser with any device inside the LAN.

The error I get is: ERR_CONNECTION_TIMED_OUT

The output the config.php:

  GNU nano 4.8                                                                             config.php
<?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,
  ),
  'passwordsalt' => 'SECRET',
  'secret' => 'SECRET',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'somesubdomain.duckdns.org',
    2 => '192.168.YY.XX',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.2.2',
  'overwrite.cli.url' => 'https://somesubdomain.duckdns.org',
  'overwritehost' => 'somesubdomain.duckdns.org',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'SECRET',
  'installed' => true,
  'instanceid' => 'SECRET',
  'maintenance' => false,
  'loglevel' => 2,
);

Any news?? No one can help me??

This problem occurs when trying to access from the own server to localhost.
I get redirected to the DDNS url and it’s extremely slow.

I do not understand. You said you could already connect via HTTPS from the internet. What connection information did you use for that? A DDNS hostname? Or an IP? I guess you should already have a port-forwarding done in your router, otherwise you shouldn’t have been able to connect from the internet?