Nextcloud config.php is the primary configuration file of Cloud software, responsible for controlling many fundamental aspects of server operation. It can be customized using a simple text editor. Any modification must, however, be carried out with caution, as poor configuration can quickly lead to instabilities and errors.
Nextcloud file config.php : what is it about?
At Nextcloud, the config.php acts as central configuration file for many basic parameters of server operation. We find there in particular the basic parameters of the latter, the connections to the databases, but also the security and performance variables. Nextcloud Logging options can also be set there, such as setting the level or choosing logging methods. However, not all Nextcloud settings are included in the file config.php. Nextcloud app settings, for example, are usually managed directly by the apps themselves.
The configuration file is an essential tool for customizing and managing Nextcloud. It is customized both during software installation, during changes to the Cloud infrastructure and as part of troubleshooting operations. So it is important for Nextcloud administrators to know how to manage the file config.php.
Advice
With Managed Nextcloud from IONOS, you benefit from all the advantages of Cloud software without having to worry about administration or having specific technical knowledge. When you subscribe to Managed Nextcloud, IONOS takes care of all necessary system updates as well as regular maintenance.
File format config.php
In general, the Nextcloud file config.php is a pure text file with specific formatting for the different parameters and values. This way the file is expandable and can interact easily with the Nextcloud software. It is also viewable using any text viewer or the command line.
From a technical point of view, the configuration file is a PHP file containing a special array called $CONFIG. This ordered map associates values with keys. The different parameters can correspond to different types of data:
Integer: integers like0,1,2And3.Float: floating point numbers like1.234Or77.55.String: character string with a maximum length of 4 KB, such asabcdefg.Boolean: Boolean value which is eithertrue(true) eitherfalse(fake).
Uploading the Nextcloud file config.php
The Nextcloud configuration file config.php is located in the Nextcloud installation directory config/ and can be supplemented by other data added to this location. To do this, it is necessary to name the file according to the diagram config.php and format it correctly.
On startup, Nextcloud automatically scans the location config.php to see if it has been modified, and does so regularly while in use. With the default OPcache settings, the software checks for directory updates every 2 seconds. With most preset versions this increases to around 60 seconds.
To edit the Nextcloud file config.phpproceed as follows:
- Before customizing the configuration file, you absolutely must make a backup of the file. The command is as follows:
sudo cp /var/snap/nextcloud/current/nextcloud/config/config.php config.php.bak. - Next, open the file in your text editor with the command
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php. - Add desired settings or edit existing entries.
- Save the changes and then verify that the Nextcloud server is functioning normally.
Make sure the syntax is correct, because even a missing comma or misplaced quotation marks can affect the entire system. Incorrect syntax can therefore not only impair functionality, but also cause security problems and lead to reduced performance. To quickly identify and resolve potential issues, it is recommended tomake changes step by step.
Managed Nextcloud
Cloud storage that puts you in control
- Effectively protect your data with industry-leading security
- Save time on updates and maintenance
- Easily add apps and collaboration tools
Overview of important settings
The Nextcloud file config.php allows you to personalize a large number of parameters flexibly. You will find the full list of available configuration settings, along with helpful comments, in the file config.sample.phpinstalled automatically when installing Nextcloud. A detailed description of each variable is available in the Nextcloud documentation. The overview below shows the main settings that administrators need to know so they can adjust them as needed.
Basic settings
dbtype: database typedbname: name of the database useddbhost: host name or IP address of the database servertrusted_domains: defines the domains or IP addresses from which access is possible
User experience
default.language: sets the default languagedefault.phone.region: sets the default region for phone numbers
User session
remember_login_cookie_lifetime: defines the duration of the connection cookiesession_lifetime: defines after how long an inactive session ends
mail_domain: defines the sender address for outgoing emails
Note
Copy all settings from file config.sample.php in the file config.php may cause unexpected problems. Generally speaking, it is recommended to add only those settings that you actually need to change.

