Pages

Wednesday, 13 August 2014

Backup all MySQL DB in Plesk


 
You can use the below script to take all DB backup to local folder. 
It will take compressed format. 
 
 
 
#!/bin/bash
# Jared Earle, 2008-03-28, BD-NTWK
# Set the datestamp, login credentials and backup directory
export date=$(date +\%Y\%m\%d)
export creds="-uadmin -p`cat /etc/psa/.psa.shadow`"
export backupdir="/local/backup/folder"
# delete week old files
find ${backupdir}/ -regex '.*.dump.gz' -mtime +6 -exec rm {} \;
# dump databases to the backupdir
echo "show databases;" | mysql ${creds} | egrep -v ^Database$ | \
        awk '{print "mysqldump ${creds} "$1" | \
        gzip > ${backupdir}/db-"$1"-${date}.dump.gz"}' | \
        sh
 
Thanks to http://23x.net/ 

Saturday, 19 July 2014

WordPress Multisite Images not Working



If you run out the issue with the Image loading in your WP multisite then, use the below htaccess rules in your site's document root.


====================
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

</IfModule>
# END WordPress

====================


It will resolve the issue for you.

Wednesday, 23 April 2014

How to manage "Error establishing database connection" error

1. The first thing that you need to verify that MySQL server running fine or not. If it's not running see the error log in

/var/lib/mysql/hostname.err

You will get the error from there. Fix the error and start the MySQL instant.

2. Sometime you will see this error even after successful restart of MySQL server. You need to make sure the error is not there for all sites. If it's only for one domain, then  it's due to one particular database connection string.

You need to make sure the database user has enough permission over the database. Also update the password of the database user from WHM >> SQL user password reset
option as per the site's configuration file.

This will fix the issue

3. If everything updated correctly and the error still appears then, please see if that database is corrupted or not. You can check this by taking a backup of the database using mysqldump. If it's showing any error for any table fix the table and the error will disappear.

In some WP site, WP-super cache plugin caused some caching issue. So consider the cache settings too, while handling WP sites.

Wednesday, 16 April 2014

How to Get Rid of Heartbleed Bug


   The best way to get rid of  "Heartbleed Bug" is to upgrade OpenSSL version to the latest one.

Please follow below script to update OpenSSL

curl https://www.openssl.org/source/openssl-1.0.1g.tar.gz | tar xz && cd openssl-1.0.1g && ./config && make && make install

ln -sf /usr/local/ssl/bin/openssl `which openssl`

openssl version

You are done :)

Thursday, 10 April 2014

Disable Recursion for DNS [Plesk,Windows and Linux]

                     

              To restrict as much as possible attack on your name server and avoid your resources consumed by tons of illegitimate queries, it’s wise to disable recursive lookup from the Internet for domains that are not served by your DNS server. The DNS server will attempt to resolve the name locally, then will forward requests to any DNS servers specified as forwarders. If Do not use recursion for this domain is enabled, the DNS server will pass the query on to forwarders, but will not recursively query any other DNS servers (e.g. External DNS servers) if the forwarders cannot resolve the query. If Disable recursion (also disables forwarders) is set, The server will attempt to resolve a query from its own database only. It will not query any additional servers.

Disable Recursion in Plesk

   1. Log into the Plesk Admin Panel.
   2. Select Tools and Settings.
   3. Click DNS Template Settings from the section.
   4. Select Localnets from the DNS Recursion section.
   5. Click the OK button.

Disable Recursion in Windows Server 2003 and 2008

  1.  Access the DNS Manager from the Start menu:
        Click the Start button.
        Select Administrative Tools.
        Select DNS.
  2.  Right click on the desired DNS Server in the Console Tree.
  3.  Select the Proprerties tab.
  4. Click the Advanced button in the Server Options section.
  5.  Select the Disable Recursion checkbox.
  6. Click the OK button.

Disable Recursion in Linux

    /etc/bind/named.conf
    /etc/named.conf
    Open the named.conf file in your preferred editor.
    Add the following details to the Options section:
    allow-transfer {"none";};
    allow-recursion {"none";};
    recursion no;
    Restart the service;