Problems with config.php and Redis

Hey all

Im having some issues with config.php and redis. I hope someone can help. Apache delivers fine on the main domain.com, but not on the subdirectory with nextcloud in it.

When enabled im getting this message when accessing the site

https://defuse.ca/b/HyBQbfJ5O3SFcv4L5fMnG2

Config.php

https://defuse.ca/b/ZcloaPW2yaGsIBuSzkDksd

Test that redis is working on the socket

https://defuse.ca/b/td2IzGOl4qqVNRanA7fZp6

Does your webserver user have access to the redis socket? It might not be able to open /var/run…

This is my Redis configuration. I’m also using memcache on redis so that cli (cron jobs) also use Redis cache)

config.php

  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/redis.sock',
    'port' => 0,
    'timeout' => 0,
    'dbindex' => 0,
  ),

redis.conf

unixsocket /tmp/redis.sock
unixsocketperm 774

ls -laF /tmp/redis.sock

srwxrwxr-- 1 apache apache 0 Oct 19 15:37 /tmp/redis.sock=

I cannot see any related message which points to a Redis problem.
How do you know your problem is related to it?
Have you tried to use the array() syntax instead of using square brackets (I don’t know if it matters, but it is worse a try), like e.g.

YOUR SYNTAX:                   USUAL SYNTAX:

'redis' => [                   redis' =>  array (
    'host' => ...                 'host' => ...
    ...                            ...
),                             ),

Have you checked the socket access rights of the Redis socket as described here:

Have you tried to access Redis using the network interface, like

  'redis' =>  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 0.0,
  ),

Afk. But I added redis (uid) to the http group. Permissions on /var/run/redis/redis.sock shows redis redis. Both redis and http needs write access as I understand.

Thank u very much for sharing

Brackets or not, same problem. Network interface works fine. But it’s a bit slower, so I wanted to try the socket solution.

It works now. It was the permissions on the socket. needs to be owned and writeable by the webserver. BUT now I got another problem

When redis restarts it changes the ownership of the socket file.

Proof
https://defuse.ca/b/1tccBNG5j3iPEWOcbLaImQ

I just reconfigured my server to use the socket and it works seamlessly.

  1. made sure that the redis.conf file contains the following lines:
    unixsocket /var/run/redis.sock
    unixsocketperm 0770
    
  2. restarted Redis server and checked the access rights:
    # ls -al /var/run/redis.sock
    srwxrwx--- 1 redis redis 0 Oct 19 16:54 /var/run/redis.sock
    
  3. added the web server user to the redis group.
  4. made sure that the Nextcloud config.php file contains the following lines:
    'redis' =>
    array (
     'host' => '/var/run/redis.sock',
     'port' => 0,
     'timeout' => 0.0
    ),
    
  5. restarted the web server
  6. tested the Nextcloud access by executing e.g. an occ command.