# Nextcloud configuration domain

In addition to post above let me disclose requirements to the Nextcloud config.php file specified for reverse bypass. Following rows must be added into the file

```JSON
  'trusted_domains' => 
  array (
    0 => '192.168.1.4:23456',
    1 => 'allcash.asuscomm.com',
  ),
```

and following past in the bottom of file before );

```JSON
  'trusted_proxies' => 
  array (
    0 => '192.168.1.32',
    1 => 'localhost',
    2 => 'allcash.asuscomm.com,
  ),
```

Also you can override route to direct all requests over DDNS and https:// adding these rows:

```JSON
  'overwritehost' => 'allcash.asuscomm.com:443',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/Nextcloud',
```

```JSON
  'trusted_domains' => 
  array (
    0 => '192.168.1.85:444',
    1 => 'home.server.com',
  ),
  'overwrite.cli.url' => 'https://home.server.com',
  'overwritehost'     => 'home.server.com',
  'overwriteprotocol' => 'https',
  'overwritewebroot'  => '/nextcloud',
```

##### Configuration du Reverse Proxy :

```JSON
 location /nextcloud {
 proxy_pass http://192.168.1.8;
 proxy_redirect off;
 proxy_set_header Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }
```

##### Configuration Bonux :

I am running Nextcloud ver 19  
This is what works for me in NPM:

- Turn on Websockets
- Force SSL
- HSTS Enabled
- HTTP/2

In Advanced

```JSON
    location = /.well-known/carddav {
      return 301 $scheme://$host:$server_port/remote.php/dav;
    }
    location = /.well-known/caldav {
      return 301 $scheme://$host:$server_port/remote.php/dav;
    }

```