How I setup Nextcloud
Layout
My Nextcloud install is run on 2 vms and an LXC container, this is to spread the load over more servers.
web02 is the webserver, it runs nginx and only nginx php02 is the PHP server, all the data is stored here mysql02 is the DB server, it runs MariaDB docker swarm (2 nodes) is where I have the notify_push container
Installed things
Nginx has been installed from the nginx.org repo, if your on a pi and want a newer version. Go have a look at packages.sury.org
PHP is installed from https://packages.sury.org/php/
as it has PHP from 5.6 all the way up to 7.4, I use an Ansible role to get the repo setup and install all the things I need.
MariaDB is from the Debian repo, so a standard install. I have made changes to the my.cnf
to make it run in 1GB of memory.
nextcloud gets installed from the zip file from nextcloud.com, I then do steps to move the old version left and setup the new version (more below).
Nextcloud steps
To get nextcloud upgraded or installed I follow this list of steps
New Install
- select a location for the install
- make any directories I need (e.g.
mkdir /srv/www/
) - download the latest version from nextcloud.com
wget https://download.nextcloud.com/server/releases/nextcloud-29.0.6.zip
- unzip the download
unzip nextcloud-29.0.7.zip
- move to my own named directory
mv nextcloud horwood-nextcloud
- copy in my backed up config
cp /backups/config.php horwood-nextcloud/config/
upgrade
- goto were nextcloud is installed
cd /srv/www/
- download the latest version from nextcloud.com
wget https://download.nextcloud.com/server/releases/nextcloud-29.0.7.zip
- unzip the download
unzip nextcloud-29.0.7.zip
- move the old left and the new right
rm -fr horwood-nextcloud;mv horwood-nextcloud horwood-nextcloud.old;mv nextcloud horwood-nextcloud
- switch to the webserver user and run the upgrade
cd horwood-nextcloud
su www-data
php occ upgrade
Using the Redis session handler
If you are using Redis for locking and/or caching,
you may also wish to use Redis for session management. Redis can be used for centralized
session management across multiple Nextcloud application servers, unlike the standard
files
handler. If you use the Redis handler, though, you MUST ensure that session
locking is enabled. As of this writing, the Redis session handler does NOT enable
session locking by default, which can lead to session corruption in some Nextcloud apps
that make heavy use of session writes such as Talk. In addition, even when session locking
is enabled, if the application fails to acquire a lock, the Redis session handler does not
currently return an error. Adding the following settings in your php.ini
file will
prevent session corruption when using Redis as your session handler:
redis.session.locking_enabled=1
redis.session.lock_retries=-1
redis.session.lock_wait_time=10000
Full example:
[Session]
session.save_handler = redis
session.save_path = "tcp://redis:6379?weight=1, tcp://redis:6379?weight=2&timeout=2.5"
redis.session.locking_enabled=1
redis.session.lock_retries=-1
redis.session.lock_wait_time=10000
More information on configuration of phpredis session handler can be found on the PhpRedis GitHub page
Published: