Category Archives: Server Tutorial

[ How to fix ] Mod Security Showing blank page & database password change

Please check that the password in /etc/cron.hourly/modsecparse.pl matches the MySQL password of the modsec user:

grep dbpassword /etc/cron.hourly/modsecparse.pl

This will show the current password for the modsec user, then check it matches the existing one in the MySQL database:

mysql
\u mysql
select password from user where user='modsec';
select password('dbpasswordhere');

Replace dbpasswordhere with the password found when grepping the modsecparse.pl file. If the passwords do not match, reset the password:

mysql
\u mysql
UPDATE user SET Password=PASSWORD('dbpasswordhere') WHERE User='modsec';

Again, replace dbpasswordhere with the password in modsecparse.pl file. At that point, try to re-run the script using this command:

perl -w /etc/cron.hourly/modsecparse.pl

To see if you receive any further email alerts.

Increase /tmp partition size in cPanel and secure it (Cpanel)

1. Stop cpanel, apache (litespeed), mysql services:
/etc/init.d/cpanel stop
/etc/init.d/httpd stop
/etc/init.d/lsws stop
/etc/init.d/mysql stop

2. Umount /tmp and /var/tmp:
umount -l /tmp
umount -l /var/tmp

3. Move /usr/tmpDSK file to another location (just in case you’ll need to mount it somewhere else to preserve data):
mv /usr/tmpDSK /usr/tmpDSK_back

4. Modify /scripts/securetmp to set tmpdsksize to desired size:
vi /scripts/securetmp

$tmpdsksize = 2048000

5. Run:
/scripts/securetmp

6. Start cpanel, apache (litespeed), mysql services:
/etc/init.d/cpanel start
/etc/init.d/httpd start
/etc/init.d/lsws start
/etc/init.d/mysql start

That’s it!

Installing Litespeed In Cpanel

LiteSpeed Web Server is the leading high-performance, high-scalability web server. It is completely Apache interchangeable so LiteSpeed Web Server can quickly replace a major bottleneck in your existing web delivery platform. With its comprehensive range of features and easy-to-use web administration console, LiteSpeed Web Server can help you conquer the challenges of deploying an effective web serving architecture.

LiteSpeed Web Server has superior performance in terms of both raw speed and scalability. Our benchmarks demonstrate that it is more than 6 times faster than Apache. When serving static content, LiteSpeed surpasses well-respected content accelerators including thttpd, boa and TUX. When it comes to dynamic content, LiteSpeed is more than 50% faster in PHP content delivery than Apache with mod_php. Don’t just take our word for it. Download the LiteSpeed free or trial version and experience it for yourself.

These are the commands to install litespeed on your Cpanel in one step , it also compatible with EasyApache , you just have to built it with litespeed .

You can get litespeed 15days trial license from here : 

http://www.litespeedtech.com/trial/license

Install Commands :

cd /usr/src
wget http://www.litespeedtech.com/packages/cpanel/lsws_whm_plugin_install.sh
chmod 700 lsws_whm_plugin_install.sh
./lsws_whm_plugin_install.sh
rm -f lsws_whm_plugin_install.sh

Restoring The Database via SSH/Telnet

Use SSH/Telnet Client, such as PuTTy.
Note:
If your database backup resides on your home computer, you will first have to upload it via FTP to your website
Open your SSH/Telnet client and log into your website. The command line prompt you will see will vary by OS. For most hosting companies, this will bring you into the FTP root folder.

You can either change directoties to wherever the backup is located and type in the following:

mysql -u dbusername -p databasename < backupname.sql

Or if you do not want to change directories and you know the path to where the backup is located, type in the following:

mysql -u dbusername -p databasename < /path/to/backupname.sql

You will be prompted for the database password. Enter it and the database will backup.

If your hosting company has you on a remote MySQL server, such as mysql.yourhost.com, you will need to add the servername to the command line. The servername will be the same as in your config.php. The command line will be:

mysql -h servername -u dbusername -p databasename < backupname.sql

Or:

mysql -h servername -u dbusername -p databasename < /path/to/backupname.sql

Backing Up The Database via SSH/Telnet

Use SSH/Telnet Client, such as PuTTy.

Open your SSH/Telnet client and log into your website. The command line prompt you will see will vary by OS.
For most hosting companies, this will bring you into the FTP root folder.

Type in the following to create a backup in the current directory:

mysqldump –opt -Q -u dbusername -p databasename > backupname.sql

Or to create a backup in a separate directory (signified by /path/to/) type:

mysqldump –opt -Q -u dbusername -p databasename > /path/to/backupname.sql

You will be prompted for the database password. Enter it and the database will backup.

If your hosting company has you on a remote MySQL server, such as mysql.yourhost.com, you will need to add the servername to the command line. The servername will be the same as in your config.php. The command line will be:

Current directory:

mysqldump –opt -Q -h servername -u dbusername -p databasename > backupname.sql

Separate directory:

mysqldump –opt -Q -h servername -u dbusername -p databasename > /path/to/backupname.sql

You can then, if you wish, download the backup to your home computer.

How to convert innodb to myisam in kloxo

At first login into ssh then paste this into ssh window

use ‘sh /script/mysql-convert –engine=myisam’

This will automatically convert all innodb database into myisam

How to Increase database name maximum string length on kloxo

open /usr/local/lxlabs/kloxo/httpdocs/htmllib/lib/pserver/ddatabaselib.php
you can see:
static function add($parent, $class, $param)
{
global $gbl, $sgbl, $login, $ghtml; 

if ($login->isAdmin() && isset($param['nomodifyname']) && $param['nomodifyname'] === 'on') {
} else {
if (!$parent->isAdmin()) {
$param['nname'] = self::getDbName($parent->nname, $param['nname']);
} else {
$param['nname'] = substr($param['nname'], 0, 24);
}
}

if (csa($param['dbpassword'], "'")) {
throw new lxexception("password_cannot_contain_single_quote", '', "");
}

$param['username'] = $param['nname'];
$param['dbname'] = $param['nname'];
$param['dbtype'] = strtil($class, "db");

/*
if (!check_if_many_server()) {
$param['syncserver'] = 'localhost';
}
*/
return $param;

}

and then change
$param['nname'] = substr($param['nname'], 0, 16); to $param['nname'] = substr($param['nname'], 0, 24);

without limited change from is
 if ($login->isAdmin() && isset($param['nomodifyname']) && $param['nomodifyname'] === 'on') {
} else {
if (!$parent->isAdmin()) {
$param['nname'] = self::getDbName($parent->nname, $param['nname']);
} else {
$param['nname'] = substr($param['nname'], 0, 24);
}
}
change it to
 if ($login->isAdmin() && isset($param['nomodifyname']) && $param['nomodifyname'] === 'on') {
} else {
if (!$parent->isAdmin()) {
$param['nname'] = self::getDbName($parent->nname, $param['nname']);
}
}