Backup mysql and upload with ftp to remote host
June 20, 2019 | 0 comments

DATE=`date +%d%b%y`
LOCAL_BACKUP_DIR="/home/sepehr/dbbackup"
DB_NAME=""
DB_USER=""
DB_PASSWORD=""
FTP_SERVER=""
FTP_USERNAME=""
FTP_PASSWORD=""
FTP_UPLOAD_DIR=""
LOG_FILE=/home/sepehr/dbbackup/backup-DATE.log
 
############### Local Backup  ########################
 
mysqldump -u $DB_USER  -p$DB_PASSWORD $DB_NAME | gzip  > $LOCAL_BACKUP_DIR/$DB_NAME-$DATE.sql.gz
 
############### UPLOAD to FTP Server  ################

ftp -n $FTP_SERVER << EndFTP
user "$FTP_USERNAME" "$FTP_PASSWORD"
binary
hash
cd $FTP_UPLOAD_DIR
#pwd
lcd $LOCAL_BACKUP_DIR
put "$DB_NAME-$DATE.sql.gz"
bye
EndFTP
 
if test $? = 0
then
    echo "Database Successfully Uploaded to Ftp Server
        File Name $DB_NAME-$DATE.sql.gz " > $LOG_FILE
else
    echo "Error in database Upload to Ftp Server" > $LOG_FILE
fi

Nginx config file for Nodejs and Vuejs
June 12, 2019 | 0 comments

Put this config file in /etc/nginx/sites-available/ and make a soft link for this file in /etc/nginx/sites-enabled/ directory . you can see the code in read more section .

Read more

Nginx WordPress config file
June 9, 2019 | 0 comments

This file is suitable with PHP-FPM and Nginx.

First , create a new configuration file for Nginx and put it in sites-available directory of your Nginx . Its usually in /etc/nginx/sites-available/ directory.

File name must ends with .conf

Then copy and paste below code into your file and save it with the suitable name .

Read more

How to use bootstrap nav in wordpress theme
June 7, 2019 | 0 comments

You can use wp-bootstrap-navwalker github repostiory.

First of all , you must copy the class-wp-bootstrap-navwalker.php form this repository and put it in the main directory of your theme .

Download Link :

https://github.com/wp-bootstrap/wp-bootstrap-navwalker

Then you must add this code in functions.php

if ( ! file_exists( get_template_directory() . '/class-wp-bootstrap-navwalker.php' ) ) {
   // file does not exist... return an error.
   return new WP_Error( 'class-wp-bootstrap-navwalker-missing', __( 'It appears the class-wp-bootstrap-navwalker.php file may be missing.', 'wp-bootstrap-navwalker' ) );
} else {
   // file exists... require it.
   require_once get_template_directory() . '/class-wp-bootstrap-navwalker.php';
}


Read more