This presumes that Apache, Nextcloud and Redis have already been installed, with Redis running on the default TCP port 6379 and Nextcloud is configured to use that port.
When switching from using a port to using a socket, any “Redis Server Went Away” issues that crop up in Nextcloud are probably due to file permissions: Apache’s www-data
user needs access to Redis’ socket file inside /var/run/redis
. Here’s the full list of steps I took to make it work:
- open
${NEXTCLOUD_WWW_ROOT}/config/config.php
in a text editor - turn on maintenance mode by setting
'maintenance' => true
and saving the file - in the
'redis'
array,- set
'host' => '/var/run/redis/redis.sock'
- set
'port' => 0
- set
- save changes
- open
/etc/redis/redis.conf
in a text editor - change
port 6379
toport 0
- uncomment
unixsocket /var/run/redis/redis.sock
- uncomment
unixsocketperm 700
- change
unixsocketperm 700
tounixsocketperm 770
- save changes
sudo adduser www-data redis
sudo systemctl restart apache2
(for the added group to take effect)sudo systemctl restart redis-server
- open
${NEXTCLOUD_WWW_ROOT}/config/config.php
in a text editor - turn off maintenance mode by setting
'maintenance' => false
and saving the file
There’s no need to change the value of open_basedir
, or to tweak Apache’s site configuration (but do remember step #12 above: restart Apache after adding www-data
to the redis
group).