The Nextcloud config.php file is the main con­fig­ur­a­tion file of the popular cloud software and is re­spons­ible for managing a wide range of fun­da­ment­al aspects of server operation. The file can be edited using a simple text editor. However, any changes should be made with caution, as incorrect con­fig­ur­a­tions can quickly lead to in­stabil­ity and errors.

What is Nextcloud config.php?

In Nextcloud, the config.php file serves as the central con­fig­ur­a­tion file for many fun­da­ment­al server settings. These include basic server con­fig­ur­a­tions and database con­nec­tions, as well as security and per­form­ance 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 in­di­vidu­al ap­plic­a­tions.

The con­fig­ur­a­tion file is an essential tool for cus­tom­ising and managing Nextcloud. It is typically modified during the software in­stall­a­tion process, when making changes to the cloud in­fra­struc­ture, and for troubleshoot­ing purposes. For this reason, it is important that Nextcloud ad­min­is­trat­ors know how to manage the config.php file.

Tip

With Managed Nextcloud from IONOS, you can enjoy all the benefits of the cloud software without having to deal with ad­min­is­tra­tion or possess any spe­cial­ised technical knowledge. When you book Managed Nextcloud, IONOS takes care of all necessary system updates and regular main­ten­ance.

Format of the config.php file

In general, the Nextcloud config.php file is a plain text file with specific format­ting re­quire­ments for the various para­met­ers and values. These ensure that the file is ex­tend­able and also fa­cil­it­ate in­ter­ac­tion with the Nextcloud software. Ad­di­tion­ally, this format allows the file to be viewed using any text viewer or via the command line.

From a technical per­spect­ive, the con­fig­ur­a­tion file is a PHP file that contains a special array called $CONFIG. This struc­tured map links values to keys. The in­di­vidu­al para­met­ers can cor­res­pond 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 either true or false

Loading the Nextcloud config.php

Where is the Nextcloud config.php file? The file is located in the config/ directory of the Nextcloud in­stall­a­tion and can be sup­ple­men­ted with ad­di­tion­al files stored in this folder. To do so, the file must be named using the *.config.php format and correctly struc­tured.

When starting up, Nextcloud auto­mat­ic­ally 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 pre­con­figured versions, this occurs ap­prox­im­ately every 60 seconds.

How to edit the Nextcloud config.php file?

If you want to edit the Nextcloud config.php file, follow these steps:

  1. Before making any changes to the con­fig­ur­a­tion file, be sure to create a backup. Use the following command:
    sudo cp /var/snap/nextcloud/current/nextcloud/config/config.php config.php.bak
  2. Next, open the file in your local text editor with this command:
    sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php
  3. Add the desired para­met­ers or modify existing entries.
  4. Save the changes and then check whether the Nextcloud server is func­tion­ing as expected.

Be sure to use correct syntax, as even a missing comma or misplaced quotation mark can po­ten­tially affect the entire system. Incorrect syntax can not only impair func­tion­al­ity, but also cause security issues and lead to per­form­ance problems. To detect and resolve issues quickly, it’s re­com­men­ded to make changes step by step.

Managed Nextcloud
Cloud storage that puts you in control
  • Keep your data safe with industry-leading security
  • Save time on updates and main­ten­ance
  • Easily add apps and online office tools

Overview of key para­met­ers

The Nextcloud config.php file allows for flexible ad­just­ment of a wide range of para­met­ers. A complete list of all available con­fig­ur­a­tion options, along with helpful comments, can be found in the config.sample.php file, which is included during the Nextcloud in­stall­a­tion. A detailed de­scrip­tion of each variable is also available in the Nextcloud doc­u­ment­a­tion. The following overview high­lights the most important para­met­ers that ad­min­is­trat­ors should be familiar with and adjust if needed:

Basic settings

  • dbtype: Type of database
  • dbname: Name of the database in use
  • dbhost: Hostname or IP address of the database server
  • trusted_domains: Defines which domains or IP addresses are allowed to access the server

User ex­per­i­ence

  • default.language: Sets the default language
  • default.phone.region: Defines the default region for phone numbers

User session

  • remember_login_cookie_lifetime: Defines the lifetime of the login cookie
  • session_lifetime: Specifies when an inactive session should expire

Mail

  • mail_domain: Defines the sender address for outgoing emails
Note

Copying all para­met­ers from the sample file into the config.php may lead to un­ex­pec­ted issues. As a general rule, it’s best to add settings only when an ad­just­ment is actually needed!

Go to Main Menu