[solved] Can't login via web after fresh install

Nextcloud version (eg, 12.0.2): 20.0.6
Operating system and version (eg, Ubuntu 17.04): Ubuntu 20.04.1 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.1): 7.4

### Solution ###
After send this post, i tried to set up ssl… i’ve run:

a2enmod ssl
a2ensite default-ssl
service apache2 reload

and added to config.php

'overwriteprotocol' => 'https',

And everything works… God damn it…

The issue you are facing:
Hi everyone. After few days of fight, I give up and need your help. Previously i installed NC via snap and everything worked like a charm. I decided to fresh install because i would like to mount external USB storage to NC and snap is not the best option (i couldn’t do that). Nevermind.

I installed NC based on those instructions: https://www.techrepublic.com/article/how-to-install-nextcloud-20-on-ubuntu-server-20-04/ but i had some errors in apache and nextcloud logs. Finally (i think) i resolved all problems and at this moment, I don’t have any errors in logs after log in, but i provide proper login:pass, submit, page reloads and thats it. No wrong password error. Nothing. In console i see 303 http statuses on submit form. I’ve checked manually mysql credentials and it works. I used commands occ maintenance:update:htaccess, occ integrity:check-core and other. I don’t have any idea what could i do more. I read all topics about similar problems but all of them had some errors in logs. I don’t have any.

I can access to NC from my phone (app) and looks that it works fine.

  • Path to NC: /var/www/html/nextcloud/
  • I provide correct credentials to access NC. I even tried change password. Account also exists in DB.

sites-enabled/available nextcloud.conf (site is enabled)

<Directory /var/www/html/nextcloud/>
  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

  <IfModule mod_dav.c>
    Dav off


$CONFIG = array (
  'instanceid' => '[secret]',
  'passwordsalt' => '[secret]',
  'secret' => '[secret]',
  'trusted_domains' =>
  array (
    0 => '192.168.178.*',
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  //'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '[secret]',
  'installed' => true,
  'config_is_read_only' => true,

data/nextcloud.log is clear
/var/log/apache2/error.log is clear
/var/log/apache2/access.log is clear (all 200 and 303 as i mentioned)