Thursday, March 28, 2013

Fixing mod_rewrite and .htaccess on GoDaddy Hosting

I recently launched a new website on GoDaddy shared hosting. The website required mod_rewrite for SEO-friendly URLs. GoDaddy provides mod_rewrite but every time I tried to hit a two-deep URL, I would get a 404 error. Here's what I had:

# Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Increase PHP Memory Allowance Using ini_set()

On rare occasion, I need to up the memory allowed for PHP. Usually it's when I deal with large files and don't necessarily care about optimizing the file reading process but simply getting the file opened. There's an easy way to increase to amount of memory allowed to PHP right in your script:


Wednesday, March 27, 2013

How to remove cPanel Clean Backups Plug-in

There is an uninstall script packaged with the clean backups installer. Optionally you can remove the following directories:


How to install Clean Backups plug-in for cPanel/WHM

cPanels backup script will not remove backups for accounts that no longer exist and these backups will remain on the backup drive until removed. This plug-in gives administrators the ability to clean up their backup directory by setting how long they want to keep backups for accounts that no longer exist and removing those backups when they expire. The script can be run by hand or after automatically after the cPanel backup script finishes.

How to remove Account DNS Check

An uninstall script is included with the installation, you just run the self exacting installer with the command --noexec and then runt ./script/uninstall as follows:

# sh latest-accountdnscheck --noexec
# cd installd-accountdnscheck/scripts/
# sh uninstall

or run

/bin/rm -vrf /var/cpanel/accountdnscheck
/bin/rm -vrf /usr/local/cpanel/whostmgr/docroot/accountdnscheck
/bin/rm -vf /usr/local/cpanel/whostmgr/docroot/cgi/addon_acountdnscheck.cgi

How to install Account DNS Check plugin for cPanel/WHM

This plugin gives administrators the ability to easily get a list of domains on their cPanel/WHM server that do not resolve to the correct IP. This is very helpful when doing server to server transfers, or auditing a server to remove old accounts. You can run this script and easily see a list of domains that are pointing to the old server or customers who are no longer hosted on their server.

Installation Instructions

How To change NameServer Ip

From time to time it may be necessary to move you to a new range of IPs. For your convenience, we will not do this unless it is absolutely necessary.

The file that actually handles WHM > DNS Functions > Nameserver IPs area is at /var/cpanel/nameserverips.yaml location. If you want this to be changed, you'd want to make a backup of that file, then modify it:

cd /var/cpanel
cp nameserverips.yaml nameserverips.yaml.bak110711
vi nameserverips.yaml

How to set up a Mailing List in cPanel

Avoid sending to multiple addresses using the CC field; everyone will see each others email address.

You can always send to extra addresses using BCC, but this can be a hassle when you often have new people to email.

You may want to set up a mailing list to send an email to many people; there is no way for the receivers to see each others emails, and the list automatically updates with new members. There are many mailing list scripts on the internet, but we recommend to use PhpList, located in Fantastico.

cPanel Log Rotation - Effective solution to log file growth

A log file can grow without bounds if it is not managed well. Larger log files are relatively harder to manipulate and also increase in the size of log file can result in file systems to run out of space. Opening, closing and manipulating data for very large file size consumes system resources and will therefore slow down the server.

An efficient solution to this problem is log rotation. It allows automatic rotation, compression, removal and mailing of log files. Log files can be rotated daily, weekly, monthly or when it grows too large.

How to ensure cPanel server security

While considering the cPanel options to make a server secure, we can check the below options available with the cPanel. You will be able to manage each and every options below from the WHM interface. By a proper configuration of their values, we can make a server secure enough.

Security settings

How to install Centova Cast on CentOS

First you must install the required programs on CentOS.

yum install httpd php php-devel php-common php-mysql php-gd php-xml mysql mysql-server -y

Once the above has completed you will need to install the ioncube loaders. Firstly you must determine your php version.

php -v

How to Set a Secure Password

To ensure the highest level of security on all servers and accounts, we recommend that you frequently change your root password and urge all your customers to change their passwords on a regular basis as well, at least once every few months or more often. In addition, when selecting your password, make sure it’s at least 8 characters, including upper and lower case letters, numbers and symbols (example: 0 & ! .). This provides the best level of security to the most obvious and common types of hacks.

How to install mod_security for Apache

What is mod_security?

ModSecurity is an open source intrusion detection and prevention engine
for web applications. It operates embedded into the web server, acting as
a powerful umbrella - shielding applications from attacks. ModSecurity
supports both branches of the Apache web server.
You can install mod_security on Apache 1.3x or 2.x

Installation steps :

How would I uninstall WHMSonic

The process for uninstalling WHMSonic is much the same as the process for installing WHMSonic. Please follow the step-by-step directions outlined below.

Uninstalling WHMSonic via SSH:

  • Login to your cPanel/WHM server via SSH
  • Next, run the following command via Linux: 

How To Change Default SSH Port 22 in Linux

By default, SSH listens for connections on port 22. Attackers use port scanner software to see whether hosts are running an SSH service. It’s wise to change the SSH port to a number higher than 1024 because most port scanners by default don’t scan high ports.

root@localhost[~]# cd /etc/ssh/

2) Edit file: sshd_config

How to enable Ioncube cPanel

The following guide will show you enable Ioncube in cPanel.

Enabling Ioncube

  • Login to WHM (root)
  • Go to Server Configuration -> Tweak Settings -> PHP
  • Select ioncube from the radio-button for cPanel PHP loader.
  • Click on Save button.
  • That's it. This will enable Ioncube for you in 3rd party PHP binary. 

How to install Softaculous in cPanel

Installing Softaculous

Note: Before starting the installation make sure ionCube Loaders are enabled. You may refer to the following guide Enable_Ioncube_cPanel. Please make sure that the Ioncube loader is selected for the backend copy of PHP. Now SSH to your server and enter following commands:

wget -N
chmod 755

How to install WHMSonic

WHMSonic can be installed by root user under the root SSH with the following single command. After you run the following command as a root user, your software will be automatically installed and you can access to WHMSonic at your WHM Root under the plugins menu.


  • A dedicated server or VPS with WHM/cPanel.

Force LiteSpeed to Update to Latest Version on cPanel/WHM Server

Sometimes you find out that LiteSpeed won’t update to the latest version automatically. The worst is you can’t see the option to update to the latest version, although LiteSpeed has released a new version.

This happened to me when I’m using LiteSpeed version 4.1.3. LiteSpeed version 4.2 was released for about a montha but yes I can’t update it.

If you’re facing similar situation, you can update to the latest version, simply issue the following command in SSH as root.

/usr/local/lsws/admin/misc/ -f -v 4.2

Replace 4.2 to latest version that is currently available.

Fix LiteSpeed and Apache Frequently Restarted in cPanel/WHM

If you are using cPanel/WHM and having a problem where LiteSpeed or Apache frequently restarted, this is the solution.

These graceful restarts are part of the log rotation. If you want to minimize the restarts, then you may want to consider switching to the piped logging option instead for logging.

To do this login to WHM and follow the path below.

WHM → Service Configuration → Apache Configuration → Piped Log Configuration

check “Enable piped Apache logs” then click Save button.
Details about the the log file rotation is available here.

Updating Apache using Cpanel EasyApache

EasyApache is a pre configured script that allows you to easily update Apache Web server through WHM or SSH.

In this tutorial we will show you how to update apache using SSH /scripts/easyapache.


How do I scan all accounts using ClamAV

You can scan your accounts using the following commands :

clamscan -ir /home/username -l clamscanreport

If you wish to scan your whole server then use the below given command :

clamscan -ir / -l clamscanreport

After clamscan is completed a new file will be created with name clamscanreport which will contain your clam scan report.

How to install ClamAV on Linux / Centos

This hopefully should help with your installation of ClamAV.

How to install.
#1. Download the file using wget.
$ sudo wget
$ sudo wget

The following commands should install it.
$ sudo rpm -ivh clamav-0.97.2-1.el5.rf.x86_64.rpm
$ sudo rpm -ivh clamav-db-0.97.2-1.el5.rf.x86_64.rpm

How to run EasyApache via SSH

In this tutorial I’ll be showing you how to run a EasyApache update via SSH. This is handy for a number of reasons since it uses less memory, you don’t need to have a webpage open to watch it and its generally faster. Also it means you can run it in a screen and then leave it without needing to have any windows or connected to SSH.


  1. Root access to your server
  2. A profile to build on
    Hint: It’ll be easier to make a profile using the webinterface

Munin MySQL Graphs Stopped Working in WHM

I am sure many of you like me have ran into the issue of Munin MySQL stats stop working usually after a server restart or some other event. Well today I show you the simple fix for the problem.

First make sure that the MySQL root password in /root/.my.cnf is valid.

Then browse to /etc/munin/plugin-conf.d , you will see a file called cpanel.conf . Modify it completely to look like so:

Postfix Flush the Mail Queue

Traditionally you use the “sendmail -q” command to flush mail queue under Sendmail MTA. Under Postfix MTA, just enter the following command to flush the mail queue:[...]

How To: Exim Remove All messages From the Mail Queue

If you have ever had the need to delete specific email messages out of the queue here are a few commands that will help you out.  Personally on my WHM\cPanel servers I prefer to load ConfigServer’s Mail Queues plugin for cPanel. If your interested in installing CMQ here is a link to their page [...]

How To: Install CSF (Config Server Firewall)

In this guide we will walk you through installing and  configuring CSF – Config Server Firewall, a popular alternative to APF.  CSF comes with LFD and works with or without cPanel.

The wonderful part is that CSF will allow you to configure everything from within your WHM interface and also has a security analyzer that will evaluate the security of your server and suggest corrective measures to lock it down.  I personally use this on all of my servers.

CSF Install Guide and How To

Monday, March 25, 2013

How To Install Webmin on CentOS

This tutorial will guide you through 3 easy steps to installing Webmin on CentOS. This has worked on CentOS 6.

Step 1:

cat > /etc/yum.repos.d/webmin.repo << EOF
name=Webmin Distribution Neutral

How to Clear cPanel/WHM Brute Force Log from SSH

If you find that you have accidentally been locked out of your WHM/cPanel server by Brute Force Detection, you can log in to your VPS via SSH and run the following command to clear the brute force log:

    # echo "delete from brutes; delete from logins;" | mysql cphulkd

cPremote version 6.6 is available now – Compatible with cPanel 11.36

An updated version of cpremote ,  6.6 is available now  for download. This  version is fully compatible with  cPanel version 11.36
Change Log:
  •     Removed the use of /var/cpanel/3rdparty/bin/php
  •     Added new  CPPHP support
It will be automatically upgraded to the  new version. If you like to upgrade it manually, then simply run the cpremote installer in your server.

How to install/remove WHMXtra from cPanel server

The installation / removal of whmXtra is easy
To remove WHMXtra do the following.

To install WHMXtra do the following.


Now logins to WHM -> Plugins and continue with the installation procedure

htaccess and Useful Tips for Your Website

For some reason, the .htaccess file is often overlooked by web designers. If you have no idea what the .htaccess file is, I’ll just give you the Wikipedia definition: “A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration.”
But let’s get to it, here are some of the cool things you can do in your .htacces file.

Hotlinking protection with .htaccess

Websites that steal your written content can be quite annoying because they can hurt your Google rankings by creating duplicate content. However there is even worst: websites that steal your content AND don’t even make the effort of downloading images and reuploading it on their server. Loading images from your server is called hotlinking, and it’s a bad practice because it steals some of your precious bandwidth.
To preven people from hotlinking your images, just include the following lines in your htaccess file (obviously replace with your site’s URL.

RewriteBase /
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?*$ [NC]
RewriteRule .(gif|jpg|swf|flv|png)$ /feed/ [R=302,L