Ubuntu 16 server setup

adduser {{username}}
adduser {{username}} sudo

apt-get install apache2
apt-get install php
apt-get install libapache2-mod-php
apt-get install php-mcrypt
apt-get install php-mysql

apt install iptables
apt install fail2ban

apt update
apt full-upgrade
apt install build-essential
apt install tcl

add some swap

fallocate -l 1G /mnt/1GB.swap
dd if=/dev/zero of=/mnt/1GB.swap bs=1024 count=1048576
mkswap /mnt/1GB.swap
swapon /mnt/1GB.swap
chmod 0600 /mnt/1GB.swap
echo "/mnt/1GB.swap  none  swap  sw 0  0" >>/etc/fstab

apt install mysql-server
mysql_secure_installation

{{su}}

curl latest redis.io stable
make
make test
make install
mkdir /etc/redis
cp redis.conf /etc/redis

create /etc/systemd/system/redis.service – e.g.

[Unit]
Description=Redis
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target

now you need to diff your redis.conf – password, persistence, binding, etc.

when you are ready to move … (or to test, see ExecStart)

systemctl enable redis

next

cd /etc/apache2
ln mods-available/rewrite.load mods-enabled/rewrite.load