Install LiteSpeed on Cpanel server .!!!


Cheap reseller Hosting


Following post discuss how to install Install LiteSpeed  on Cpanel server.

Login to SSH on the server running cPanel.
# cd /usr/locel/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
Register for 15days trial license:
http://www.litespeedtech.com/trial/license
* Login to WHM and click the ‘LiteSpeed Web Server’ button.
* Click ‘Install LiteSpeed’ and let it run through the installation procedure.
* Enter your license information & assign an administrator password (Don’t tick the box to start LiteSpeed immediately)
* Click ‘Build matching PHP Binary’
* Click ‘Switch to LiteSpeed’
* Click ‘Admin Web Console’ and login
Final stages of setup
* Configuration > General > Index Files > Edit
Set the following and save.
Index Files: index.html, index.php, index.php5, index.htm
Auto Index: Yes
Auto Index URI => /_autoindex/default.php
* In SSH Type:
# ln -sf /usr/local/lib/php/autoindex /usr/local/lsws/share/autoindex
* Configuration > Log > Server Log > Edit
Set the following:
Log Level: Info
Debug Level: None
* Now click ‘Actions > Graceful Restart’ to make these changes permanent.
Please note that port 7080   should be enabled in the firewall


Cheap web Hosting


Enable PHP4 for single domain !!


Cheap reseller Hosting


If your server is running with default php version 5 and you want php 4 for single account so you just can add the following line in .htaccess.
Create one .htaccess file under public_html and add the following code.

AddHandler application/x-httpd-php4 .php

now you can create phpinfo page and check it will show your default php version is php4.

Cheap web Hosting


Install ImageMagick on the Cpanel server.


Cheap reseller Hosting


ImageMagick is one of the most requested add-ons that allows for image manupulation.    First, you should check GD on the server , it can be complied through easyapache.
First check Imagemagick on the server
/scripts/checkimagemagick
=======================================
Installation ImageMagick  on the server
/scripts/installimagemagick
Installation will take a couple minutes as it will install other packages needed by ImageMagick.
==========================================================
Check version of Imagemagick
/usr/bin/convert –version
It will show somthing below output.
Version: ImageMagick 6.7.1-7 2011-09-13 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
==========================================================
Install ImageMagick through WHM.
Go to WHM -> Software -> Module Installers -> PHP Pecl (manage). On the box below “Install a PHP Pecl” enter “imagick” and click “Install Now” button – that’s all.  Restart Apache.
=========================================================
Uninstall ImageMagick
ImageMagick: /scripts/cleanimagemagick
WHM : Imagick: WHM -> Software -> Module Installers -> PHP Pecl (manage). Click on Uninstall button for Imagick
==========================================================
It can check where is located ImageMagick
# whereis convert
It will show you the directory
===================================================

Cheap web Hosting


Images not loading for websites.


Cheap reseller Hosting


If you find that images are not loading in linux  server then you should disable php functions.

php.ini is configuration file of PHP.
Find exact path of php.ini
# php -i | grep php.ini

Or you can use the another command like

# php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
then search disabled disable_function in that file and remove  “readfile” optionin in that line.
: wq!
then restart apache service.

All images should be work fine.


Cheap web Hosting


How to view webalizer stats without login to cpanel .


Cheap reseller Hosting


Just follow below steps.
==============================================
cd /home/username/www
ln -s ../tmp/webalizer   webalizer
chown username.username  webalizer
cd ../tmp
chmod 755 ./
chmod 755 ./webalizer
==============================================
It will allow domain.com/webalizer/ for viewing stats without logging in to cpanel

Cheap web Hosting


How to update webalizer.


Cheap reseller Hosting


Some times , weblizer doesn’t update automatically. You  have to update manually update it. Follow the below steps to update manually update webalizer.

=============================================================
/usr/local/cpanel/3rdparty/bin/english/webalizer  -N  10  -D
/home/username/tmp/webalizer/dns_cache.db -R 250 -p -n domain.com -o
/home/username/tmp/webalizer
/usr/local/apache/domlogs/domain.com
===============================================================

Replace username and domain name of your hosting account.


Cheap web Hosting


Apache Optimization


Cheap reseller Hosting


httpd.conf is configuration file of apache server and all important options are stored there. httpd.conf is located at /usr/local/apache/conf/httpd.conf.

vi /usr/local/apache/conf/httpd.conf

MaxClients (Total number of concurrent connections.)

It should be set reasonable value because if set high value then there is chance a complete server hang in case of a DOS attack. It can set value as per hardware configuration . If you have 2 GB or RAM set this value to 300.
This should be set to a reasonable value. I suggest using this formula to determine the right value for your server.
MaxClients = 150 x RAM (GB)
If you set low value then it can create timeout problems for your clients if the limit is reached so better set reasonable value.
ServerLimit
This value should be same as MaxClients
ServerLimit = 150 x RAM (GB)
MinSpareServers and MaxSpareServers
MaxSpareServers and MinSpareServers control how many spare (unused) child-processes Apache will keep alive while waiting for more requests to put them to use. Each child-process consumes resources, so having MaxSpareServers set too high can cause resource problems. On the other hand, if the number of unused servers drops below MinSpareServers, Apache will fork (an expensive operation) new child-processes until MinSpareServers is satisfied.
should be set below value
MinSpareServers 5
MaxSpareServers 10
If you have more them 2 GB of RAM and you run a resource intensive website consider increasing MaxSpareServers.
MaxRequestsPerChild
It should not be set lower value because  it will put an unnecessary load on the apache server to recreate the child. It controls the number of request the a child serves before the child is killed
I suggest you set below value .

MaxRequestsPerChild 1000 for 1 GB RAM
10,000 for 2 GB and 0 for more than 2 GB RAM

KeepAlive and MaxKeepAliveRequests

KeepAlive provides long-lived HTTP sessions which allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents with many images, but having keepalive on is also a resource intensive setting.
Here comes the big question: To KeepAlive or not to KeepAlive?
Well the opinions are mixed here, some say to KeepAlive some say not to.

KeepAlive off
If you want to hear my option I would say NOT to KeepAlive if you are running a shared hosting business or if you want to get the most out of your hardware. You should KeepAlive only if the loading time of your pages is the most important factor in your business and you have the money to invest in a more powerful hardware. If you decide to KeepAlive I suggest you set MaxKeepAliveRequest low to something like 2 seconds.

StartServers
Sets the number of child server processes created on startup. This setting depends greatly on the type of webserver you run. If you run low traffic websites on that server set it low to something like 5. If you have resource intensive websites on that server you should set it close to MaxClients.

StartServers 5
Timeout
The amount of time Apache will wait for three things: the total amount of time it takes to receive a GET request, The amount of time between receipt of TCP packets on a POST or PUT request, the amount of time between ACKs on transmissions of TCP packets in responses.
The default value is 300. You should set time to something a bit lower. A setting of 150 is probably ok. This will also help in case of small DOS attacks like to ones targeting some phpBB forums. Do NOT set it any lower then 10 as your users will start having timeout problems.
Timeout 150
After you have done all the necessary changes you can go ahead and restart Apache.
There is an extra step that you have to do so that the changes that you done to httpd.conf aren’t lost when a recompile is done.
To also save the changes in the database you will have to run:
/usr/local/cpanel/bin/apache_conf_distiller –update
You can check to see if the changes were accepted and will not be discarded at the next apache recompile by running
/usr/local/cpanel/bin/build_apache_conf

Sample values:
MinSpareServers 5
MaxSpareServers 10
ServerLimit 600
MaxClients 600
MaxRequestsPerChild 0
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3

Cheap web Hosting


Directory Index Forbidden Error !!


Cheap reseller Hosting


If you get below in error in error_log
========================================
[Thu  Sept 13  02:09:32 2012] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /home/domainusername/public_html/
[Thu  Sept 13  02:09:32 20129] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /home/domainusername/public_html/
==================================================
Then you need to add below code in .htaccess file.
==================================
DirectoryIndex index.html
or
DirectoryIndex index.php
==================================
and then check your site.


Cheap web Hosting


Fatal error: Class ‘PDO’ not found in …includes/database/database.inc on line 184


Cheap reseller Hosting


Fatal error: Class ‘PDO’ not found in …includes/database/database.inc on line 184
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While browsing domain if you get above error then –
Please try to resolved issue with following steps. PDO support had been compiled in, but not enabled .Our server has PHP 5.2.x and 5.3x installed, with PDO support.
Adding
————-
extension=pdo.so extension=pdo_mysql.so
————-
to php.ini solved the problem.
Steps:
1. Create php.ini file
2. Add two lines

————-
extension=pdo.so
extension=pdo_mysql.so

————-
3.Save
4.restart httpd service

That’s it.. 🙂
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cheap web Hosting


Clear/Free/Remove Cache memory from Linux Server


Cheap reseller Hosting


Clear/Free/Remove Cache memory from Linux Server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please use belwo command to clear Cache memory from Linux Server
free -m
echo 1 > /proc/sys/vm/drop_caches
=======
eg :
BEFORE :
root@lnx [~]# free -m
total used free shared buffers cached
Mem: 12001 11614 386 0 2026 6996
-/+ buffers/cache: 2592 9409
Swap: 1907 0 1907
root@lnx [~]# echo 1 > /proc/sys/vm/drop_caches
AFTER :
root@lnx [~]# free -m
total used free shared buffers cached
Mem: 12001 2796 9205 0 5 390
-/+ buffers/cache: 2401 9600
Swap: 1907 0 1907
=========

Cheap web Hosting


1 21 22 23 24 25