Memcached / redis

Hello Hestia community.

I have installed Hestia 1.0.1 (amd64) with multiple PHP support on Ubuntu 18.04 and I am using apache2 with PHP-73 Web template and nginx proxy with hosting template.

I would like to install, configure and use either memcached or redis, so I would like your thought on this. Quick questions to kick-off the discussion:

  1. Are there any reasons not to do that?
  2. Which of the two would you suggest? Given that I will be using WordPress + W3 Total Cache. I have found this comparison chart and some more info here, but it’s not only about features. It’s also about which one is easier to implement in Hestia installation.
  3. I have successfully installed and configured memcached on various VESTA installations. But I guess it is not the same in this particular case, because I’m using php7.3-fpm. Could you please point me to the right direction?

Thank you for your time.

Hi

  1. No, redis or memcached will not generate any issues together with hestia.
  2. Can’t say, don’t have any knowledge here.
  3. Checkout the template directory in /usr/local/hestia/data/templates/web/apache2 and copy the template you want to have and adjust with all needed points.

Thanks @Raphael for the reply. Let me add some more info in this thread, hoping to be useful to others.

The installation of redis to act as a caching server, on an Ubuntu 18.04 with Hestia CP, is a really simple task.

  1. Install the package
    sudo apt install redis-server

  2. Edit the config file sudo nano /etc/redis/redis.conf and set the following parameters (for 64MB memory - adjust if you need more/less):
    maxmemory 67108864
    maxmemory-policy allkeys-lru

  3. Install the redis php extension
    sudo apt install php-redis

  4. Restart the services
    sudo systemctl restart redis.service php7.3-fpm.service

5 Likes

May I suggest you to configure redis in a more secure way ?
like

  1. adding a password to access redis
  2. not getting access to everyone by using a group to redis service
  3. and for more speed and security using the socket instead of the TCP port

[[ -z $REDISPWD ]] &&
REDISPWD=$(openssl rand --base64 24)
sed 's ^port.* port 0 ’ -i /etc/redis/redis.conf
sed 's ^# unixsocket .* unixsocket /var/run/redis/redis.sock ’ -i /etc/redis/redis.conf
sed 's ^# unixsocketperm .* unixsocketperm 770 ’ -i /etc/redis/redis.conf
sed "s ^# requirepass .* requirepass $REDISPWD " -i /etc/redis/redis.conf
for hUSER in $(grep hestia /etc/group cut -d: -f4 sed ‘s/,/ /g’); do
usermod -aG redis $hUSER; done
systemctl restart redis
ref

so at the end your apps will access redis like this
nextcloud as an example

6 Likes

after all this, do we need any wordpress plugin to use this redis server or it will automatically start working?

I have checked that wordpress has some plugin by tim kurtis

You may need to tell it the host (localhost or 127.0.0.1) and port. Or it might just guess these if they are default. If you added a password, it would definitely have to be told about that.

How best to install php-redis for specific php versions?

Getting error

systemctl status php8.0-fpm.service
● php8.0-fpm.service - The PHP 8.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.0-fpm.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-08-24 22:12:24 BST; 32s ago
Docs: man:php-fpm8.0(8)
Process: 215331 ExecStart=/usr/sbin/php-fpm8.0 --nodaemonize --fpm-config /etc/php/8.0/fpm/php-fpm.conf (code=exited, status=78)
Process: 215332 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.0/fpm/pool.d/www.conf 80 (code=exited, status=0/SUCCESS)
Main PID: 215331 (code=exited, status=78)
CPU: 26ms

Aug 24 22:12:24 server.domain.com systemd[1]: Starting The PHP 8.0 FastCGI Process Manager…
Aug 24 22:12:24 server.domain.com php-fpm8.0[215331]: [24-Aug-2021 22:12:24] ERROR: unable to bind listening socket for address ‘127.0.0.1:9000’: Address already in use (98)
Aug 24 22:12:24 server.domain.com php-fpm8.0[215331]: [24-Aug-2021 22:12:24] ERROR: FPM initialization failed
Aug 24 22:12:24 server.domain.com systemd[1]: php8.0-fpm.service: Main process exited, code=exited, status=78/CONFIG
Aug 24 22:12:24 server.domain.com systemd[1]: php8.0-fpm.service: Failed with result ‘exit-code’.
Aug 24 22:12:24 server.domain.com systemd[1]: Failed to start The PHP 8.0 FastCGI Process Manager.

Though most domains still using php 7.3 7.4

thanks

rm /etc/php/8.0/fpm/pool.d/www.conf

no errors now thanks

But still redis not installing on php versions?

apt install phpx.x-redis

should work fine

1 Like

Please do not revive that old threads, just create a new one with your question.