What is Nextcloud config.php? Everything you need to know
The Nextcloud config.php file is the main configuration file of the popular cloud software and is responsible for managing a wide range of fundamental aspects of server operation. The file can be edited using a simple text editor. However, any changes should be made with caution, as incorrect configurations can quickly lead to instability and errors.
What is Nextcloud config.php?
In Nextcloud, the config.php file serves as the central configuration file for many fundamental server settings. These include basic server configurations and database connections, as well as security and performance variables. Nextcloud logging options can also be defined in this file, such as setting the log level or selecting logging methods. However, there are also many Nextcloud settings that are not included in the config.php file. The settings for Nextcloud apps are generally managed directly through the individual applications.
The configuration file is an essential tool for customising and managing Nextcloud. It is typically modified during the software installation process, when making changes to the cloud infrastructure, and for troubleshooting purposes. For this reason, it is important that Nextcloud administrators know how to manage the config.php file.
With Managed Nextcloud from IONOS, you can enjoy all the benefits of the cloud software without having to deal with administration or possess any specialised technical knowledge. When you book Managed Nextcloud, IONOS takes care of all necessary system updates and regular maintenance.
Format of the config.php file
In general, the Nextcloud config.php file is a plain text file with specific formatting requirements for the various parameters and values. These ensure that the file is extendable and also facilitate interaction with the Nextcloud software. Additionally, this format allows the file to be viewed using any text viewer or via the command line.
From a technical perspective, the configuration file is a PHP file that contains a special array called $CONFIG. This structured map links values to keys. The individual parameters can correspond to different data types:
Integer: Whole numbers such as ‘0’, ‘1’, ‘2’, and ‘3’Float: Decimal numbers such as ‘1.234’ or ‘77.55’String: Character strings up to four kilobytes in length, such as ‘abcdefg’Boolean: A Boolean value that is eithertrueorfalse
Loading the Nextcloud config.php
Where is the Nextcloud config.php file? The file is located in the config/ directory of the Nextcloud installation and can be supplemented with additional files stored in this folder. To do so, the file must be named using the *.config.php format and correctly structured.
When starting up, Nextcloud automatically scans the config.php location for changes, and it continues to check regularly during operation. With the default OPcache settings, the software checks the directory for updates every two seconds; however, in most preconfigured versions, this occurs approximately every 60 seconds.
How to edit the Nextcloud config.php file?
If you want to edit the Nextcloud config.php file, follow these steps:
- Before making any changes to the configuration file, be sure to create a backup. Use the following command:
sudo cp /var/snap/nextcloud/current/nextcloud/config/config.php config.php.bak - Next, open the file in your local text editor with this command:
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php - Add the desired parameters or modify existing entries.
- Save the changes and then check whether the Nextcloud server is functioning as expected.
Be sure to use correct syntax, as even a missing comma or misplaced quotation mark can potentially affect the entire system. Incorrect syntax can not only impair functionality, but also cause security issues and lead to performance problems. To detect and resolve issues quickly, it’s recommended to make changes step by step.
- Keep your data safe with industry-leading security
- Save time on updates and maintenance
- Easily add apps and online office tools
Overview of key parameters
The Nextcloud config.php file allows for flexible adjustment of a wide range of parameters. A complete list of all available configuration options, along with helpful comments, can be found in the config.sample.php file, which is included during the Nextcloud installation. A detailed description of each variable is also available in the Nextcloud documentation. The following overview highlights the most important parameters that administrators should be familiar with and adjust if needed:
Basic settings
dbtype: Type of databasedbname: Name of the database in usedbhost: Hostname or IP address of the database servertrusted_domains: Defines which domains or IP addresses are allowed to access the server
User experience
default.language: Sets the default languagedefault.phone.region: Defines the default region for phone numbers
User session
remember_login_cookie_lifetime: Defines the lifetime of the login cookiesession_lifetime: Specifies when an inactive session should expire
mail_domain: Defines the sender address for outgoing emails
Copying all parameters from the sample file into the config.php may lead to unexpected issues. As a general rule, it’s best to add settings only when an adjustment is actually needed!

