...
Being by installing the following:
Code Block sudo apt-get install redis-server php-redis
Edit the Redis config with this:
Code Block sudo nano /etc/redis/redis.conf
Search for the bind command and add your IP to the end of it:
Code Block bind 127.0.0.1 YOUR_IP_ADDRESS
Add this at the end of the file
Code Block maxmemory 256mb maxmemory-policy allkeys-lru
Open your php.ini, find and replace the following line with:
Code Block session.save_handler = redis
In the php.ini also uncomment and replace this line:
Code Block session.save_path = "tcp://YOUR_IP_ADDRESS:6379"
- Drupal 8
- Grab the Redis module, enable it on your instance
Make sure the Redis module is enabled before you add these settings into your settings.php in, it will cause a WSOD if you don't
Code Block // Redis Settings $settings['redis.connection']['interface'] = 'PhpRedis'; $settings['redis.connection']['host'] = '127.0.0.1'; $settings['cache']['default'] = 'cache.backend.redis'; $settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast'; $settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast'; $settings['cache']['bins']['config'] = 'cache.backend.chainedfast'; $settings['container_yamls'][] = 'modules/contrib/redis/example.services.yml';
- Wordpress
- Install the WP Redis plugin
Create a file wp-content/object-cache.php and put this in it:
<?php # This is a Windows-friendly symlink require_once WP_CONTENT_DIR . '/plugins/wp-redis/object-cache.php';Code Block - Verify by going to wp-admin/plugins.php?plugin_status=dropins , you should see the object-cache.php file in there.
...
Run these commands
Code Block sudo apt-get install apt-transport-https curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add - sudo sh -c 'echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list' sudo apt-get update sudo apt-get install varnish
Now edit the varnish setup
Code Block sudo nano /etc/default/varnish
- Change the line DAEMON_OPTS="-a :6081 \
- to DAEMON_OPTS="-a :80 \
- to DAEMON_OPTS="-a :80 \
- Change the line DAEMON_OPTS="-a :6081 \
LEMP + Drupal
Edit the default vcl
Code Block sudo nano /etc/varnish/default.vcl
- Copy this file into it: https://gist.github.com/labboy0276/cae7f121e1abe2321926cdf699702cd0
- Copy this file into it: https://gist.github.com/labboy0276/cae7f121e1abe2321926cdf699702cd0
Edit your hosts file
Code Block sudo nano /etc/nginx/sites-available/drupal
- Change the listen port from 80 to 8008
- Change the listen port from 80 to 8008
- LAMP
LEMP + Wordpress
Edit the default vcl
Code Block sudo nano /etc/varnish/default.vcl
- Copy this file into it: https://gist.github.com/labboy0276/cae7f121e1abe2321926cdf699702cd051a4f12e7db556133824baee7e060cc6
- Copy this file into it: https://gist.github.com/labboy0276/cae7f121e1abe2321926cdf699702cd051a4f12e7db556133824baee7e060cc6
Edit
the config:your hosts file
Code Block sudo nano /etc/apache2/ports.conf
Add or change what is there for these values:
NameVirtualHost 127.0.0.1:8008 Listen 127.0.0.1:Code Block nginx/sites-available/digitalocean
- Change the listen port from 80 to 8008
- LAMP + Wordpress
Edit the default vcl
Code Block sudo nano /etc/varnish/default.vcl
- Copy this file into it: https://gist.github.com/labboy0276/4ab90d2f1a3b1b4c82942048cc3ed1d1
- Copy this file into it: https://gist.github.com/labboy0276/4ab90d2f1a3b1b4c82942048cc3ed1d1
Edit the config:
Code Block sudo nano /etc/apache2/ports.conf
Change the Listen port to 8008
Edit your hosts file:
Code Block sudo nano /etc/apache2/sites-available/000-default.conf
- Change the listen port from 80 to 8008
- reboot the server