Configuring Nextcloud for Nginx or visa-versa

Nextcloud version (eg, 20.0.5): 24.0.6
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): v2.9.18
PHP version (eg, 7.4): 7.4

Sorry this will be a bit long winded.


Nextcloud installed in a Proxmox LXC container
Nginx installed in a separate Proxmox container
Both within the same PVE node.

I can login to both Nextcloud (via IP and Domain name setup in Nginx) and Nginx.

The issue I have is that there is a warning under Security & Setup warning related to;

  • You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This most likely means that you are behind a reverse proxy and the overwrite config variables are not set correctly. Please read the documentation page about this :arrow_upper_right:.

  • Your web server is not properly set up to resolve “/.well-known/caldav”. Further information can be found in the documentation :arrow_upper_right:.

  • Your web server is not properly set up to resolve “/.well-known/carddav”. Further information can be found in the documentation :arrow_upper_right:.

I’ve looked up the issue related to these warning and have found the code I need to insert to configuration as I believe it’s slowing down my system as when I login it’s sits on the login screen until I refresh the page, but does actually login.

My problem is that I’ve no idea where I meant to insert the documented code and in what files. I though I was meant to use the Nextcloud config.php file under the nextcloud instance name, but looking at the file it does not have any thing like the examples I seen or any code area like Location or Array. My next thought perhaps I’m in the wrong area and need to config Nginx, but could not find any file in the similar structure either.

I should mention the I installed Nextcloud using snap library which maybe contributing to the issue.

I’m pretty much a newbie in Linux, but have managed to learn a lot in setting these up as have others that are running fine in the same node.

Any help in directing me in what file/s I should be looking for to edit and location in newbie terms would be greatly appreciated, as I believe I can complete the rest.

Hopefully someone with smarter brain takes pity on a 60year old trying to learn new stuff, lol.

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

Steps tried:

  1. Found a conf under Nginx path /data/nginx/proxy_host, add snippet to no avail.

The output of your Nextcloud log in Admin > Logging:

Unfortunately nothing logged relates to this it is all before this showed.

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

$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,
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'passwordsalt' => 'SECRET',
  'secret' => 'SECRET',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '',
    2 => 'My_domain',
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'USRNAME',
  'dbpassword' => 'PASSWORD',
  'installed' => true,
  'default_phone_region' => 'MY_COUNTRY',

Thanks in advance