Connection refused after moving ISP

After moving to a new place (and thus getting a new wireless router, static IP). After setting up the DNS on my provider and proper port forwards on port 80 and 443, I was able to access the server both using the local IP and my domain name.

I then ssh’ed to the machine to check the status, and since it had been off while packing and moving, a lot of updates were available. I did a sudo apt upgrade and rebooted.

Since then, access to nextcloud has been sporadic, in the sense that sometimes I can access it fine (albeit the interface seems oddly slow), but most of the time, I get a “connection refused” (both from Firefox and the iPhone app).

If I spam refresh fast enough in Firefox, I’ll be able to see the “Go back (recommended)” and “Advanced” buttons briefly, before the connection refused message.

I can’t seem to see a pattern in when I can/can’t access it. One minute it may work, the next minute not, or it might work for hours, and then not again for hours. Any hints will be much appreciated!

Nextcloud version: 21.0.1snap2 rev 28088
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.2 LTS

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,
  ),
  'instanceid' => '***********',
  'passwordsalt' => '***********',
  'secret' => '***********',
  'trusted_domains' => 
  array (
    0 => '***********',
    1 => '***********'
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => '***********',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '***********',
  'installed' => true,
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'cloud',
  'mail_domain' => '***********',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => '***********',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '***********',
  'mail_smtppassword' => '***********',
  'mail_smtpsecure' => 'tls',
  'loglevel' => 0,
  'theme' => '',
);