Second NC instance 404 after initial setup

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 22.2.3
Operating system and version : Debian 11
Nginx version: 1.18.0
PHP version: 7.4.25

The issue you are facing:
I’m trying to get the second NC instance on another subdomain running. First NC is running well. Below is the Nginx config of the second instance. Instead of opening the dashboard or login page I’m getting 404, inintial setup over web UI is runnig. The permits are set by chown -R www-data:www-data /var/www/nextcloud

 1 server {
 2     listen 80;
 3     listen [::]:80;
 4     server_name cloud.example.net;
 5     return 301 https://$server_name:443$request_uri;
 6 }
 7
 8 server {
 9     listen 443 ssl http2;
10     listen [::]:443 ssl http2;
11     server_name cloud.example.net;
12     root /var/www/nextcloudst;
13     index index.php index.html index.htm;
14
15     ssl_certificate /etc/letsencrypt/live/cloud.example.net/fullchain.pem;
16     ssl_certificate_key /etc/letsencrypt/live/cloud.example.net/privkey.pem;
17
18     ssl_dhparam /etc/nginx/ssl/dhparams.pem;
19 #    ssl_trusted_certificate /etc/letsencrypt/cloud.example.net/ca.pem;
20     ssl_protocols TLSv1.2 TLSv1.3;
21     ssl_ciphers 'TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384';
22     ssl_ecdh_curve secp521r1:secp384r1;
23     ssl_prefer_server_ciphers on;
24     ssl_stapling on;
25     ssl_stapling_verify on;
26     ssl_session_timeout 24h;
27 #    ssl_session_cache shared:SSL:50m;
28     ssl_session_tickets off;
29
30     add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
31     add_header Referrer-Policy "no-referrer" always;
32     add_header X-Content-Type-Options "nosniff" always;
33     add_header X-Download-Options "noopen" always;
34     add_header X-Frame-Options "SAMEORIGIN" always;
35     add_header X-Permitted-Cross-Domain-Policies "none" always;
36     add_header X-Robots-Tag "none" always;
37     add_header X-XSS-Protection "1; mode=block" always;
38
39     fastcgi_hide_header X-Powered-By;
40
41     access_log off;
42
43   location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
44         try_files $uri /index.php$request_uri;
45         # Optional: Don't log access to other assets
46         access_log off;
47     }
48
49     location /.well-known/carddav {
50             return 301 $scheme://$host/remote.php/dav;
51     }
52
53     location /.well-known/caldav {
54             return 301 $scheme://$host/remote.php/dav;
55     }
56
57     rewrite ^/.well-known/webfinger /index.php$uri redirect;
58     rewrite ^/.well-known/nodeinfo /index.php$uri redirect;
59 }
60
61 location ~ \.php$ {
62    include snippets/fastcgi-php.conf;
63    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
64}

Is this the first time you’ve seen this error?: Y

Steps to replicate it:

  1. Intstall second nextcloud instance
  2. Make the initial setup in web UI
  3. Try to open NC

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

<?php
$CONFIG = array (
  'instanceid' => 'ocuic1candoc',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => 'DE',
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'allow_local_remote_servers' => true,
  'trusted_domains' =>
  array (
    0 => 'cloud.example.net',
    1 => 'office.example.net',
  ),
  'onlyoffice' =>
  array (
    'verify_peer_off' => true,
    'jwt_header' => 'Authorization',
    'jwt_secret' => 'XXX',
  ),
  'datadirectory' => '/media/cloud',
  'dbtype' => 'mysql',
  'version' => '22.2.2.0',
  'overwrite.cli.url' => 'https://cloud.example.net',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
);

nano /etc/hosts

127.0.0.2       cloud.example1.net
127.0.0.4       cloud.example2.net

(post deleted by author)

Corrected a mistake in ciphers (during copy&paste I didn’t select the whole line so it was not complete and didn’t end with “;”).
After I tried also both, to use the same database as first instance and also a new one.
Eberything end in 404 :frowning:

Also tried to use different storage locations.