Skip to content

Configure config.php

scubamuc edited this page Jun 4, 2024 · 27 revisions

Some Nextcloud snap settings may need to be done directly in the config.php configuration file. Whilst the default configurations are mostly fine, it may be necessary to fine tune Nextcloud snap.

Nextcloud documentation

Nextcloud configuration parameters

Nextcloud snap, editing configuration file

The configuration file can be edited manually. Take good care to preserve the syntax and special characters, as incorrect formatting or misplaced characters and spaces may render your Nextcloud unusable. So be sure to backup the original config.php file before editing.

  • Backup config.php
sudo cp /var/snap/nextcloud/current/nextcloud/config/config.php config.php.bak
  • Edit config.php
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php 

Setting trusted domains

View trusted domains (iterating values 0, 1, 2...):

sudo nextcloud.occ config:system:get trusted_domains 0

Set trusted domains (iterating values 0, 1, 2...):

sudo nextcloud.occ config:system:set trusted_domains 0 --value=cloud.mydomain.xyz

Adding multiple trusted domains manually in config.php:

edit config.php and add/edit section

sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php 
 'trusted_domains' =>
  array (
    0 => 'cloud.mydomain.xyz',
    1 => 'another.mydomain.xyz',
    2 => 'localhost',
    3 => 'nextcloud.local',
  ),

Setting trusted proxies

Adding trusted proxies manually in config.php:

edit config.php and add/edit section

sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php 
  'trusted_proxies' => 
  array (
    0 => 'your.reverse.proxy.ip',
    1 => 'your.other.proxy.ip',
   ),

or issue command on host (iterating values 0, 1, 2...):

sudo nextcloud.occ config:system:set trusted_poxies 0 --value="your.reverse.proxy.ip"

Setting overwrite parameters

Nextcloud overwrite parameters such as overwriteprotocol and overwritehost are two configs that absolutely depend on your reverse proxy setup.

Be aware that some devices require an additional setting in config.php if your Nextcloud snap instance is behind a reverse proxy.

For internet facing Nextcloud snap that handles encryption itself or a pass-through reverse proxy is present it shouldn't be necessary to set overwriteprotocol and overwritehost.

edit config.php and add/edit section

    'overwriteprotocol' => 'https',
    'overwritehost' => 'mydomain.com',

or issue command:

sudo nextcloud.occ config:system:set overwriteprotocol --value="https"

sudo nextcloud.occ config:system:set overwritehost --value="my.domain.com"

Skeleton for default Nextcloud documents, files and folders etc.

Default documents, files and folders for new users may be placed in a "skeleton" directory. Thus new users will find documents files an folders in their Nextcloud upon first login. Create a skeleton directory /var/snap/nextcloud/common/skeleton

sudo mkdir /var/snap/nextcloud/common/skeleton

Add your default files folders here. You may also add group folders here. See Group folders app

edit config.php and add skeleton directory path

'skeletondirectory' => '/var/snap/nextcloud/common/skeleton',

Setting default maintenance window

Set default maintenance window time 01:00 (1 a.m.)

edit config.php and add/edit line in config.php

'maintenance_window_start' => 1,

or issue command on host:

sudo nextcloud.occ config:system:set maintenance_window_start --value="1"

Setting default phone region

country codes

edit config.php and add/edit line in config.php

'default_phone_region' => 'US',

or issue command on host:

sudo nextcloud.occ config:system:set default_phone_region --value="US"

Setting default language

country codes

edit config.php and add/edit line in config.php

'default_language' => 'en',

or issue command on host:

sudo nextcloud.occ config:system:set default_language --value="en"

Setting default locale

country codes

edit config.php and add/edit line in config.php

'default_locale' => 'en_US',

or issue command on host:

sudo nextcloud.occ config:system:set default_locale --value="en_US"

Setting default folder for shares

edit config.php and add/edit line in config.php

'share_folder' => '/SHARE_with_others',

or issue command on host:

sudo nextcloud.occ config:system:set share_folder --value="/SHARE_with_others"

Setting default folder for shared with me

edit config.php and add/edit line in config.php

'share_folder' => '/SHARED_with_me',

or issue command on host:

sudo nextcloud.occ config:system:set share_folder --value="/SHARED_with_me"

Remove signup link

edit config.php and add/edit line in config.php

'simpleSignUpLink.shown' => false,

or issue command on host:

sudo nextcloud.occ config:system:set simpleSignUpLink.shown --value="false"
Clone this wiki locally