-
-
Notifications
You must be signed in to change notification settings - Fork 238
Configure config.php
Some Nextcloud snap settings may need to be done directly in the config.php configuration file. While the default configurations are mostly fine, it may be necessary to fine tune Nextcloud snap.
The configuration file can be edited manually.
Important
Take 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
Adding multiple trusted domains manually in config.php:
- edit
config.php
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php and add/edit section
'trusted_domains' =>
array (
0 => 'cloud.yourdomain.xyz',
1 => 'cloud.yourotherdomain.zxy',
2 => 'localhost',
3 => 'nextcloud.local',
),
or issue occ command on host (iterating values 0, 1, 2...):
sudo nextcloud.occ config:system:set trusted_domains 0 --value=cloud.yourdomain.xyzCaution
Be aware that the values for trusted_domains should be domain names (see FQDN). IP addresses are not domain names! See hosts & FQDN configuration.
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 occ command on host (iterating values 0, 1, 2...):
sudo nextcloud.occ config:system:set trusted_proxies 0 --value="your.reverse.proxy.ip"
Caution
Be aware that these values should be IPv4 or IPv6 addresses in CIDR notation see reverse proxy documentation
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' => 'cloud.yourdomain.xyz',
or issue occ command on host:
sudo nextcloud.occ config:system:set overwriteprotocol --value="https"
sudo nextcloud.occ config:system:set overwritehost --value="cloud.yourdomain.xyz"
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 occ command on host:
sudo nextcloud.occ config:system:set maintenance_window_start --value="1"
edit config.php and add/edit line in config.php
'default_phone_region' => 'GB',
or issue occ command on host:
sudo nextcloud.occ config:system:set default_phone_region --value="GB"
edit config.php and add/edit line in config.php
'default_language' => 'en',
or issue occ command on host:
sudo nextcloud.occ config:system:set default_language --value="en"
edit config.php and add/edit line in config.php
'default_locale' => 'en_GB',
or issue occ command on host:
sudo nextcloud.occ config:system:set default_locale --value="en_GB"
edit config.php and add/edit line in config.php
default value is
""(empty)
'defaultapp' => '<appname>',
or issue occ command on host:
sudo nextcloud.occ config:system:set defaultapp --value="<appname>"
example: sudo nextcloud.occ config:system:set defaultapp --value="mail"
or
edit config.php and add/edit line in config.php
'has_internet_connection' => 'true',
or issue occ command on host:
sudo nextcloud.occ config:system:set has_internet_connection --value="true"
edit config.php and add/edit line in config.php
'share_folder' => '/SHARE_with_others',
or issue occ command on host:
sudo nextcloud.occ config:system:set share_folder --value="/SHARE_with_others"
edit config.php and add/edit line in config.php
'share_folder' => '/SHARED_with_me',
or issue occ command on host:
sudo nextcloud.occ config:system:set share_folder --value="/SHARED_with_me"
Note
The default setting keeps files and folders in the trashbin for 30 days and automatically deletes anytime after that if space is required.
add/edit line in config.php and add trashbin_retention_obligation
'trashbin_retention_obligation' => 'auto',
to enable the background job issue command:
sudo nextcloud.occ config:app:delete files_trashbin background_job_expire_trash
Example: keep files and folders in the trash bin for at least 90 days and delete when exceeds 120 days
edit config.php and add/edit line in config.php
'trashbin_retention_obligation' => '90, 120',
or issue occ command on host:
sudo nextcloud.occ config:system:set trashbin_retention_obligation --value="90, 120"
to enable the background job issue command:
sudo nextcloud.occ config:app:delete files_trashbin background_job_expire_trash
to disable the background job issue command:
sudo nextcloud.occ config:app:set --value=no files_trashbin background_job_expire_trash
Tip
Be aware that files may not be deleted automatically if space is available. To cleanup the trashbin manually run:
sudo nextcloud.occ trashbin:cleanup --all-users
also note, there is a difference between trashbin and groupfolders-trashbin. To cleanup groupfolders-trashbin run:
sudo nextcloud.occ groupfolders:trashbin:cleanup -f
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',
or issue occ command on host:
sudo nextcloud.occ config:system:set skeletondirectory --value="/var/snap/nextcloud/common/skeleton"
'session.cookie_secure' => 'true',
or issue command on host:
sudo nextcloud.occ config:system:set session.cookie_secure --value="true"
the default session lifetime ist 24 hours after which an idle user will be logged out automatically. Session lifetime and auto logout may be configured to suit your needs.
- session_lifetime parameters are not user specific and apply to all users when configured
- auto_logout is required and dependent on session_lifetime
Tip
avoid session_lifetime below 4 hours in a corporate environment, as users will complain
Official Nextcloud documentationm
edit config.php and add/edit section
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php
'session_lifetime' => 28800,
'session_keepalive' => false,
'auto_logout' => true,
Tip
the documentation may be misleading, calculate the value for session_lifetime:
- default value 24 hours (
60*60*24) =86400 - value for 12 hours (
60*60*12) =43200 - value for 8 hours (
60*60*8) =28800 - value for 4 hours (
60*60*4) =14400
edit config.php and add/edit line in config.php
'simpleSignUpLink.shown' => false,
or issue occ command on host:
sudo nextcloud.occ config:system:set simpleSignUpLink.shown --value="false"
If your user backend does not allow password resets (e.g. when it's a read-only user backend like LDAP), disable password reset link
edit config.php and add/edit line in config.php
'lost_password_link' => 'disabled',
or issue occ command on host:
sudo nextcloud.occ config:system:set lost_password_link --value="disabled"
you can specify a custom link, where the user is redirected to, when clicking the "reset password" link after a failed login-attempt
'lost_password_link' => 'https://example.org/link/to/password/reset',
Nextcloud snap Wiki, use all information and scripts at own risk
- HTTP/HTTPS port configuration
- PHP configuration options
- Hosts & FQDN configuration
- Reverse proxy configuration
- CODE & Nextcloud Office configuration
- HPB client-push configuration
- Managing Nextcloud snap
- Managing automatic updates
- Managing automatic update issues
- Managing external media and storage
- Managing logs
- Managing services
- Managing cron
- Managing HTTP encryption
- OCC management console