How to migrate WordPress site to CloudFlare SSL

In this article I’m going to show you how to enable CloudFlare Flexible SSL for your WordPress website.

Cloudflare flexible SSL is the simplest method, to get your site running under SSL (HTTPS) fast and free. Using CloudFlare, you don’t need to purchase an SSL certificate and do any complicated server configuration, pretty much any host will work.
I will try to create very detailed guide on how to do this right, with proper redirects for non-SSL content and HSTS. Don’t be afraid of it’s length, the steps are fairly simple.

What you gonna need

  • A WordPress site with admin access and ability to install plugins.
  • Access to your domains DNS records. In the example I’m going to use a domain name registered at godaddy.com, but any other registrar should work, you just have to look for an option to change name servers.
  • CloudFlare account. You can create one for free here: https://www.cloudflare.com/a/sign-up

Continue reading

How to backup directory in Linux (using cron)

Very simple script, for regular backup of a specific directory under Linux.

Create file backup.sh

#!/bin/sh

SOURCE=/path/of/data #what should we backup
DESTINATION=/home/user/backups #where to store backups
DELETEAFTER=5 #how many days should we store the backups

mkdir -p $DESTINATION
cd $DESTINATION
tar -zcvf latest-backup.tgz $SOURCE
mv latest-backup.tgz $(date +%y%m%d%H)-backup.tgz
find . -name '*-backup.tgz' -mtime +$DELETEAFTER -delete

Continue reading