WordPress Backup Script


# This script creates a compressed backup archive of the given directory and the given MySQL table. More details on implementation here: https://theme.fm
# Feel free to use this script wherever you want, however you want. We produce open source, GPLv2 licensed stuff.
# Author: Konstantin Kovshenin exclusively for Theme.fm in June, 2011
# Modification by Hasan T. Emdad tweenpath.net on August, 2020

# Set the date format, filename and the directories where your backup files will be placed and which directory will be archived.

NOW=$(date +"%Y-%m-%d-%H%M")

# MySQL database credentials

# Tar transforms for better archive structure.

# Create the archive and the MySQL dump
tar -cvf $BACKUP_DIR/$FILE --transform $WWW_TRANSFORM $WWW_DIR
mysqldump --user=${DB_USER} --password=${DB_PASS} $DB_NAME > $BACKUP_DIR/$DB_FILE

# Append the dump to the archive, remove the dump and compress the whole archive.
tar --append --file=$BACKUP_DIR/$FILE --transform $DB_TRANSFORM $BACKUP_DIR/$DB_FILE

Easyengine installaiton on Debian 10

Install Easyengine WordPress on a Debian 10 VM (mine was a KVM).

The following procedure will install EE with following components;

  • Docker
  • WordPress Core
  • MariaDB
  • Nginx Server PHP-FPM
  • Redis Cache
  • Let’s encrypt SSL

Install EasyEngine on Linux

wget -qO ee rt.cx/ee4 && sudo bash ee
ee site create your_domain --type=wp --ssl=le --cache

For detailed installation or customizing your requirement, you may visit- https://easyengine.io/commands/site/create/ Continue reading “Easyengine installaiton on Debian 10” »


Upgrade WordPress without FTP

Open /wp-config.php

Now the first thing you need to do is to open the wp-config.php file from your WordPress root folder (you may access this file from your WordPress installer folder). From the installation folder, the file is located at wordpress/wp-config.php


Paste the following code to your wp-config.php file, preferably just below every other line of code.


Save and Try updating now. If you have inappropriate directory and file permission, might  encounter upgrade error. Try to do the following-

Web Server Ownership

The first level is actually to make sure that your web server has ownership over the directories:

chown -R www-data:www-data your-wordpress-directory

Directory Permissions

The second level is also required – you must make sure that the directory permissions are properly set:

sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \; 
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;
sudo chown -R www-data:www-data wp-content/plugins/
sudo chmod 775 wp-content
sudo chown -R www-data:www-data wp-content/

Nginx wordpress fancy URL or permalink fixing

If your wordpress is installed in the root directory i.e. yourdomain.com, you can use the following directives-

location / {
try_files $uri $uri/ /index.php?$args;

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;

Or if your wordpress is installed inside a sub-directory the directive will be a bit different-

location /test/site1 {
try_files $uri $uri/ /test/site1/index.php?$args;

# Add trailing slash to */wp-admin requests.
rewrite /test/site1/wp-admin$ $scheme://$host$uri/ permanent;