See directory listing of web files after upgrading Ubuntu 16.04 to 18.04

Nextcloud version (eg, 20.0.5): 20.0.10.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04 (upgraded from 16.04)
Apache or nginx version: Apache/2.4.29 (Ubuntu)
PHP version (eg, 7.4): 7.2

The issue you are facing:
I upgraded Ubuntu from 16.04 to Ubuntu 18.04 (self-hosted). When I visit the local ip address it gives a list of the web directory rather than nextcloud.
image

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

Steps to replicate it:

  1. Start with working Nextcloud in Ubuntu 16.04
  2. Upgrade server using sudo do-release-upgrade
  3. Visit local IP address of server in web browser

The output of your Nextcloud log in Admin > Logging:

nextcloud.log too large for me to open (3.4 GB)

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

<?php
$CONFIG = array (
  'instanceid' => ###REMOVED####,
  'passwordsalt' => ###REMOVED####,
  'secret' => ###REMOVED####,
  'trusted_domains' =>
  array (
    0 => '192.168.1.88',
    1 => ###REMOVED####,
  ),
  'datadirectory' => '/var/www/owncloud/data',
  'overwrite.cli.url' => ###REMOVED####,
  'dbtype' => 'mysql',
  'version' => '20.0.10.1',
  'dbname' => 'oc',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => ###REMOVED####,
  'dbpassword' => ###REMOVED####,
  'logtimezone' => 'UTC',
  'installed' => true,
  'theme' => '',
  'loglevel' => 0,
  'log_rotate_size' => 104857600,
  'maintenance' => true,
  'updatechecker' => false,
  'htaccess.RewriteBase' => '/',
  'singleuser' => false,
  'updater.server.url' => 'https://updates.nextcloud.com/updater_server/',
  'updater.secret' => ###REMOVED####
  'updater.release.channel' => 'stable',
);

The output of your Apache/nginx/system log in /var/log/____:
See https://pastebin.com/5NSvpcLK

I ran an adapted version of the strong permissions script, but I can still see files if I visit <localip>/apps/files/ or <localip>/data/<username>. What am I missing?

In the end it was an oversight on the directory name.

In my case I migrated from owncloud so my installation is still at /var/www/owncloud. I missed a reference to /var/www/nextcloud in nextcloud.conf. Here’s the corrected (for me) nextcloud.conf.

<VirtualHost *:80>
  DocumentRoot /var/www/owncloud/
  ServerName  cloud.example.com

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

    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
</VirtualHost>