IT in Education

Using multiple config.php files

nextcloudYou can create arbitrary files that end .config.php files. These .config.php files are never overwritten by Nextcloud and they take precedence of config.php. This article gives some examples.


memcached.config.php

This is the Memcached configuration that works for me.

<?php
$CONFIG = array (
// Memcached settings
'memcache.local' => '\OC\Memcache\Memcached',
'memcache.distributed' => '\OC\Memcache\Memcached',
'memcached_servers' => array(array('localhost', 11211),),
);

mail.config.php

This is the configuration, that allows Nextcloud to use a SMTP mail server to send notification emails. Change the highlighted entries for your setup.

<?php $CONFIG = array (
// Pre-configuration of the mail service account 'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => 'ssl', 'mail_sendmailmode' => 'smtp', 'mail_from_address' => 'donotreply', 'mail_domain' => 'myschool.org', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtpauth' => 1, 'mail_smtphost' => 'smtp.gmail.com', 'mail_smtpport' => '465', 'mail_smtpname' => 'This email address is being protected from spambots. You need JavaScript enabled to view it.', 'mail_smtppassword' => 'my_email_account_password',
);

users.config.php

Here are some personal settings for users, that I typically apply.

<?php
$CONFIG = array (

// Personal user setting preferences 'default_language' => 'en_GB', 'default_locale' => 'en_GB', 'default_phone_region' => 'GB', 'allow_user_to_change_display_name' => false, 'defaultapp' => 'apporder', // If apporder isn't installed, Files app is used 'versions_retention_obligation' => 'auto,365', 'skeletondirectory' => '', // This will stop new users getting demo files
'simpleSignUpLink.shown' => false, // This will remove the 'Get your own free account' link
);

admin.config.php

Here are some administrative settings that I find useful.

<?php $CONFIG = array (

// Administrative settings 'check_for_working_wellknown_setup' => false, //I disabled this check to remove warning 'appstoreenabled' => false, // Prevent accidental installation of apps 'updatechecker' => true, 'updater.release.channel' => 'stable', 'upgrade.disable-web' => true, // This will force me to upgrade using OCC commands );

mysettings.config.php

Alternatively you can put all the above settings into one .config.php file.

<?php $CONFIG = array ( 'memcache.local' => '\OC\Memcache\Memcached', 'memcache.distributed' => '\OC\Memcache\Memcached', 'memcached_servers' => array(array('localhost', 11211),),

'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => 'ssl', 'mail_sendmailmode' => 'smtp', 'mail_from_address' => 'donotreply', 'mail_domain' => 'myschool.org', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtpauth' => 1, 'mail_smtphost' => 'smtp.gmail.com', 'mail_smtpport' => '465', 'mail_smtpname' => 'This email address is being protected from spambots. You need JavaScript enabled to view it.', 'mail_smtppassword' => 'my_email_account_password',

'default_language' => 'en_GB', 'default_locale' => 'en_GB', 'default_phone_region' => 'GB', 'allow_user_to_change_display_name' => false, 'defaultapp' => 'apporder', // If apporder isn't installed, Files app is used 'versions_retention_obligation' => 'auto,365', 'skeletondirectory' => '', // This will stop new users getting demo files
'check_for_working_wellknown_setup' => false, //I disabled this check to remove warning 'appstoreenabled' => false, // Prevent accidental installation of apps 'updatechecker' => true, 'updater.release.channel' => 'stable', 'upgrade.disable-web' => true, // This will force me to upgrade using OCC commands );


Thanks for visiting,
Steven