FQDN dissapearing in the URL bar

G’day all,

I’ve recently installed nextcloud on a Virtual Ubuntu server. The server is accessed via Nginx reverse proxy (Which runs on a different VM). The issue I’m facing is that if go to www[.]example[.] com/nextcloud it will sometimes change the URL to https://nextcloud and return an error 404.

My config files are as per below.

Nextcloud:

php
$CONFIG = array (
‘instanceid’ => ‘xxx’,
‘passwordsalt’ => ‘xxx’,
‘secret’ => ‘xxx’,
‘trusted_domains’ =>
array (
0 => ‘192.168.’,
1 => ‘www.example.com’,
),
‘trusted_proxies’ =>
array (
0 => ‘192.168.’,
),
‘datadirectory’ => ‘/var/www/nextcloud/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘18.0.3.0’,
‘overwriteprotocol’ => ‘https’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘XXX’,
‘dbpassword’ => ‘XXX’,
‘installed’ => true,
‘overwrite.cli.url’ => ‘http://www.example.com/nextcloud’,
‘twofactor_enforced’ => ‘false’,
‘twofactor_enforced_groups’ =>
array (
0 => ‘Users’,
1 => ‘admin’,
),
‘twofactor_enforced_excluded_groups’ =>
array (
),
);

And my Nginx config:

location / {
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 64;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Front-End-Https on;
# whatever the IP of your cloud server is
proxy_pass http://192.168.x.x;
}

Any help would be greatly appreciated.

Thanks.