Features of LiteSpeed WebServer
- Runs on almost all platforms like Linux, FreeBSD, Solaris, Mac OS X etc
- It is fully compatible with most of the common control panels like cPanel, Ensim, DirectAdmin, Plesk, etc.
- PHP scripting is up to 50% faster than Apache’s mod_php
1.Litespeed configuration
1.1 Check Litespeed
Take http://IP:7080/ on the browser, you will see a Litespeed welcome page.
Let us check if it is listening to the port we have mentioned.
# netstat -pant | grep lshttpd
tcp 0 192.168.1.19:7080 0.0.0.0:* LISTEN 18718/lshttpd
tcp 0 192.168.1.19:80 0.0.0.0:* LISTEN 18718/lshttpd
1.2 Admin Area
You can manage the admin area at
http://IP:7080/.
Here IP is your server IP
1.3 Log Files are resides under
log :: /usr/local/lsws/.
2. To Integrate with DA
LiteSpeed Web Server works very well with Directadmin managed web sites. The performance will increase up to 10x times by replacing apache with lsws.
To replace Apache with LSWS :-
2.1 Goto admin area
Access admin area at http://IP:7080 and with the admin username and password.
2.2 Goto Configurations >> Server >> General.
Keeping the cursor against the button along with each option will give you a small definition about the same.
2.3 Scroll down to “Using Apache Configuration File”
Load Apache Configuration => Yes
Auto Reload On Changes => Yes (Changes made in WHM/cPanel will be applied automatically)
Apache Configuration File => /usr/local/apache/conf/httpd.conf
Apache Port Offset => 1000 (Try LiteSpeed on port 1080 and 1443 first, change to 0 later)
Apache IP Offset => 0
PHP suEXEC => Yes (Run PHP in suEXEC mode)
PHP suEXEC Max Conn => 8 (The maximum PHP processor each account can have)
2.4 Scroll back up to “Index Files” and set it as follows:
Index Files index.html, index.php, index.php5, index.php4, index.htm
Auto Index Not Set
Auto Index URI Not Set
2.5 Scroll down to “HT Access”
Allow Override Check: Limit, Auth, FileInfo, Indexes, Options Uncheck: None
Access File Name .htaccess
2.6 Goto Configurations >> Server >> Listeners
delete all current listeners.
2.7 Now restart the webserver
service lsws restart
33 PHP recompilation
By default, Litespeed comes with PHP 4.4.x compiled with LSAPI and hence we have to install latest stable version of PHP with LSAPI for our LiteSpeed. With PHP LiteSpeed SAPI, LiteSpeed’s PHP performance is much more efficient than Apache’s mod_php or fast_CGI.
You can easily recompile PHP in the server from the Panel.
3.1 login to admin area.
http://IP:7080/.
3.2 Go to
Admin >> Actions >> Recompile PHP
3.3 Recompile PHP
Compile PHP with LSAPI
3.3.1 Step 1 : Select a PHP version
Here you can select PHP version. Select your desired PHP version and click next.
3.3.2 Step 2 : Choose PHP 5.2.9 Build Options
Here I have selected PHP 5.2.9
a. Load Configuration
- Use configuration from previous Build
- Restore default
b. Install Path Prefix - You can specify installation path
c. Configure Parameters - Configuration command
d. Security Patches Suhosin (General Hardening) Mail Header (Identifies Mail Source)
e. Install Opcode Cache None APC eAccelerator XCache
3.2.4 Click Build PHP
3.4 Here you will get a custom phpbuild command.
If you log in as root, you can directly run the command:
# /usr/local/lsws/phpbuild/buildphp_manual_run.sh
If you log in as a user who has sudo permission, you can run the command with sudo and input root password after prompt.
$ sudo /usr/local/lsws/phpbuild/buildphp_manual_run.sh
To apply changes, please visit Control Panel and execute a Graceful Restart. Apply Changes
Tuesday, August 2, 2011
Install Configuring Litespeed Webserver
1.1 Features of LiteSpeed WebServer
- Runs on almost all platforms like Linux, FreeBSD, Solaris, Mac OS X etc
- It is fully compatible with most of the common control panels like cPanel, Ensim, DirectAdmin, Plesk, etc.
- PHP scripting is up to 50% faster than Apache's mod_php
- supports CGI, Fast CGI, PHP, Servlet/JSP, Proxy, SSLv2/SSLv3/TLSv1, IPv4 and IPv6
- GZIP compression
- high performance .htaccess implementation, this alone can double the server capacity and reduce server load by 5-10 times against using apache.
- LDAP authentication
- Apache compatible URL rewrite engine
- MS FrontPage Server Extension
- Strictest HTTP request validation
- Deny any buffer-overrun attempt
- Secure against popular DoS attacks
- Chroot support
- Chroot and suexec CGI script
- supports FastCGI suEXEC for improved security
- Small memory footprint
- Thousands of concurrent connections
- Increase scalability of external web applications
- Efficient and high performing CGI daemon and Perl daemon
- SSL Hardware acceleration
- can recover from service failure instantly
- Migration from other webservers is quite quick and easy
- this can also act as a security guard in front of current webserver and hence improving performance, scalability and security.
- can perform up to 50% better during high loads when compared to httpd and lighttpd.
- PHP CGI/FCGI SAPI
- With PHP LiteSpeed SAPI, LiteSpeed's PHP performance is up to 100% better than Apache's mod_php.
- Ruby LSAPI is about 50% faster than Ruby FCGI for the simple "Hello, World" test.
2. Install LiteSpeed
# cd /usr/src
# wget http://litespeedtech.com/packages/3.0/lsws-3.1.1-std-i386-linux.tar.gz
# tar -xvzf lsws-3.1.1-std-i386-linux.tar.gz
# cd lsws-3.1.1
# ./install.sh
You will encounter few questions and need to select the following options:
* Do you agree with above license? Yes
* Destination [/opt/lsws]: /opt/lsws [ /usr/local/lsws can also be used]
* User name [admin]: admin
* Password: youradminpassword
* Retype password: youradminpassword
* User [nobody]: nobody [use a non-system user that doesn't have a shell access and home directory]
* Group [nobody]: nobody [group the webserver will be running as]
* HTTP port [8088]: 1080 [you can give any port you wish to run lsws. If any other webserver is running on this port, stop it before starting lsws]
* Admin HTTP port [7080]: 7080
* Both these ports should be enabled in the firewall
* Setup up PHP [Y/n]: Y
* Suffix for PHP script(comma separated list) [php]: php
* Would you like to change PHP opcode cache setting [y/N]? N
* Would you like to install AWStats Add-on module [y/N]? N
* Would you like to import Apache configuration [y/N]? N
* Would you like to have LiteSpeed Web Server started automatically when the machine restarts [Y/n]? Y
* Would you like to start it right now [Y/n]? Y
LiteSpeed Web Server started successfully! Have fun!
2.1 Check Litespeed
Take http://192.168.1.19:1080/ on the browser, you will see a Litespeed welcome page.
Let us check if it is listening to the port we have mentioned.
# netstat -pant | grep lshttpd
tcp 0 192.168.1.19:7080 0.0.0.0:* LISTEN 18718/lshttpd
tcp 0 192.168.1.19:80 0.0.0.0:* LISTEN 18718/lshttpd
2.2 Admin Area
You can manage the admin area at
http://192.168.1.19:7080/.
Here 192.168.1.19 is my local machine's ip.
2.3 Log Files
The log files are located at /opt/lsws/logs.
3. To Integrate with Cpanel
LiteSpeed Web Server works very well with cPanel managed web sites. The
performance will increase up to 10x times by replacing apache with lsws.
To replace Apache with LSWS :-
3.1 Goto admin area
Access admin area at http://192.168.1.19:7080 and with the admin username and password.
3.2 Goto Configurations >> Server >> General.
Keeping the cursor against the button along with each option will give you a small definition about the same.
3.3 Scroll down to "Using Apache Configuration File"
Load Apache Configuration => Yes
Auto Reload On Changes => Yes (Changes made in WHM/cPanel will be applied automatically)
Apache Configuration File => /usr/local/apache/conf/httpd.conf
Apache Port Offset => 1000 (Try LiteSpeed on port 1080 and 1443 first, change to 0 later)
Apache IP Offset => 0
PHP suEXEC => Yes (Run PHP in suEXEC mode)
PHP suEXEC Max Conn => 8 (The maximum PHP processor each account can have)
3.4 Scroll back up to "Index Files" and set it as follows:
Index Files index.html, index.php, index.php5, index.php4, index.htm
Auto Index Not Set
Auto Index URI Not Set
3.5 scroll down to "HT Access"
Allow Override Check: Limit, Auth, FileInfo, Indexes, Options Uncheck: None
Access File Name .htaccess
3.6 Goto Configurations >> Server >> Listeners
delete all current listeners.
3.7 Now restart the webserver
service lsws restart
4. PHP
By default, Litespeed comes with PHP 4.4.x compiled with LSAPI and hence we have to install latest stable version of PHP with LSAPI for our LiteSpeed. With PHP LiteSpeed SAPI, LiteSpeed's PHP performance is much more efficient than Apache's mod_php or fast_CGI.
# /opt/lsws/fcgi-bin/lsphp -v
PHP 4.4.7 (litespeed) (built: May 30 2007 05:16:33)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
4.1 Download the latest stable PHP
# wget http://in2.php.net/distributions/php-5.2.3.tar.gz
# tar -zxf php-5.2.3.tar.gz
# cd php-5.2.3
# cd sapi
4.2 Download and expand latest LSAPI for PHP into the “sapi” folder:
# wget http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.0.tgz
# tar -zxf php-litespeed-4.0.tgz
4.3 Change directory to php-5.2.3 and run commands:
# cd ..
# touch ac*
# ./buildconf --force
4.4 Configure/Compile PHP:
4.4.a # php -i | grep configure | sed "s/'//g" | sed "s/'//g"
4.4.b # Remove the "--with-apxs=/usr/local/apache/bin/apxs" part from 6.4.a
and add '--prefix=/php5' '--with-litespeed' '--with-config-file-path=../php'
# ./configure '--prefix=/php5' '--with-litespeed'
'--with-config-file-path=../php' --with-mysql ...[append the full options from
4.4.a]
# make
# make install
Note: You must compile PCRE (Perl Compatible Regular Expressions) support in
order for the default auto-index PHP script to work correctly (at least this
is true for 3.0RC2).
4.5 Replace the lsphp binary in /opt/lsws/fcgi-bin/lsphp with /php-5.2.3/sapi/litespeed/php:
# cd /opt/lsws/fcgi-bin/
# mv lsphp lsphp.old
# cp /php-5.2.3/sapi/litespeed/php lsphp
4.6 To check installation success:
# /opt/lsws/fcgi-bin/lsphp -v
PHP 5.2.3 (litespeed) (built: May 31 2007 14:05:12)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
4.7 php.ini
The php.ini file will be located at /opt/lsws/php/php.ini
If we want to use the old PHP.ini just copy it here.
# cd /opt/lsws/php
# mv php.ini php.ini.old
# cp /usr/local/ZEND/etc/php.ini .
4.8 Restart Litespeed Webserver
Finally restart LSWS and use our new PHP binary.
/opt/lsws/bin/lswsctrl restart and thats it. You are done !!!
5. Limitations
This webserver comes as Standard version (which is free and it has several limitations) and it comes as an Enterprise version (which is more optimized and it doesn't have much limitations). Few drawbacks of free version are: the Maximum Concurrent Connections is limited to 150, it cannot utilize more than one processor etc. Hence, to utilize the full advantage of LSWS you have to purchase the Enterprise version.
6. Conclusion
We have installed LiteSpeed Webserver and integrated it to use with CPanel. Now the web pages will load fast. At the same time the server load and memory usage will be lower. More web sites can now be hosted on this server and we can feel the speed. In short, LiteSpeed is the best choice for shared hosting service providers in terms of performance, security and server capacity.
Go ahead, give LiteSpeed a try and discover why over 300,000 internet domains are currently powered by LSWS.
References:
http://litespeedtech.com/
http://en.wikipedia.org/wiki/LiteSpeed_Web_Server/
http://creativeflux.co.uk/entry/replacing-apache-with-litespeed/
http://www.usefuljaja.com/litespeed
Downloads:
http://www.php.net/downloads.php
http://www.litespeedtech.com/products/webserver/lsapi/
Categories for this entry
* Technical Bench » Software Installations - General
* Technical Bench » Webserver
- Runs on almost all platforms like Linux, FreeBSD, Solaris, Mac OS X etc
- It is fully compatible with most of the common control panels like cPanel, Ensim, DirectAdmin, Plesk, etc.
- PHP scripting is up to 50% faster than Apache's mod_php
- supports CGI, Fast CGI, PHP, Servlet/JSP, Proxy, SSLv2/SSLv3/TLSv1, IPv4 and IPv6
- GZIP compression
- high performance .htaccess implementation, this alone can double the server capacity and reduce server load by 5-10 times against using apache.
- LDAP authentication
- Apache compatible URL rewrite engine
- MS FrontPage Server Extension
- Strictest HTTP request validation
- Deny any buffer-overrun attempt
- Secure against popular DoS attacks
- Chroot support
- Chroot and suexec CGI script
- supports FastCGI suEXEC for improved security
- Small memory footprint
- Thousands of concurrent connections
- Increase scalability of external web applications
- Efficient and high performing CGI daemon and Perl daemon
- SSL Hardware acceleration
- can recover from service failure instantly
- Migration from other webservers is quite quick and easy
- this can also act as a security guard in front of current webserver and hence improving performance, scalability and security.
- can perform up to 50% better during high loads when compared to httpd and lighttpd.
- PHP CGI/FCGI SAPI
- With PHP LiteSpeed SAPI, LiteSpeed's PHP performance is up to 100% better than Apache's mod_php.
- Ruby LSAPI is about 50% faster than Ruby FCGI for the simple "Hello, World" test.
2. Install LiteSpeed
# cd /usr/src
# wget http://litespeedtech.com/packages/3.0/lsws-3.1.1-std-i386-linux.tar.gz
# tar -xvzf lsws-3.1.1-std-i386-linux.tar.gz
# cd lsws-3.1.1
# ./install.sh
You will encounter few questions and need to select the following options:
* Do you agree with above license? Yes
* Destination [/opt/lsws]: /opt/lsws [ /usr/local/lsws can also be used]
* User name [admin]: admin
* Password: youradminpassword
* Retype password: youradminpassword
* User [nobody]: nobody [use a non-system user that doesn't have a shell access and home directory]
* Group [nobody]: nobody [group the webserver will be running as]
* HTTP port [8088]: 1080 [you can give any port you wish to run lsws. If any other webserver is running on this port, stop it before starting lsws]
* Admin HTTP port [7080]: 7080
* Both these ports should be enabled in the firewall
* Setup up PHP [Y/n]: Y
* Suffix for PHP script(comma separated list) [php]: php
* Would you like to change PHP opcode cache setting [y/N]? N
* Would you like to install AWStats Add-on module [y/N]? N
* Would you like to import Apache configuration [y/N]? N
* Would you like to have LiteSpeed Web Server started automatically when the machine restarts [Y/n]? Y
* Would you like to start it right now [Y/n]? Y
LiteSpeed Web Server started successfully! Have fun!
2.1 Check Litespeed
Take http://192.168.1.19:1080/ on the browser, you will see a Litespeed welcome page.
Let us check if it is listening to the port we have mentioned.
# netstat -pant | grep lshttpd
tcp 0 192.168.1.19:7080 0.0.0.0:* LISTEN 18718/lshttpd
tcp 0 192.168.1.19:80 0.0.0.0:* LISTEN 18718/lshttpd
2.2 Admin Area
You can manage the admin area at
http://192.168.1.19:7080/.
Here 192.168.1.19 is my local machine's ip.
2.3 Log Files
The log files are located at /opt/lsws/logs.
3. To Integrate with Cpanel
LiteSpeed Web Server works very well with cPanel managed web sites. The
performance will increase up to 10x times by replacing apache with lsws.
To replace Apache with LSWS :-
3.1 Goto admin area
Access admin area at http://192.168.1.19:7080 and with the admin username and password.
3.2 Goto Configurations >> Server >> General.
Keeping the cursor against the button along with each option will give you a small definition about the same.
3.3 Scroll down to "Using Apache Configuration File"
Load Apache Configuration => Yes
Auto Reload On Changes => Yes (Changes made in WHM/cPanel will be applied automatically)
Apache Configuration File => /usr/local/apache/conf/httpd.conf
Apache Port Offset => 1000 (Try LiteSpeed on port 1080 and 1443 first, change to 0 later)
Apache IP Offset => 0
PHP suEXEC => Yes (Run PHP in suEXEC mode)
PHP suEXEC Max Conn => 8 (The maximum PHP processor each account can have)
3.4 Scroll back up to "Index Files" and set it as follows:
Index Files index.html, index.php, index.php5, index.php4, index.htm
Auto Index Not Set
Auto Index URI Not Set
3.5 scroll down to "HT Access"
Allow Override Check: Limit, Auth, FileInfo, Indexes, Options Uncheck: None
Access File Name .htaccess
3.6 Goto Configurations >> Server >> Listeners
delete all current listeners.
3.7 Now restart the webserver
service lsws restart
4. PHP
By default, Litespeed comes with PHP 4.4.x compiled with LSAPI and hence we have to install latest stable version of PHP with LSAPI for our LiteSpeed. With PHP LiteSpeed SAPI, LiteSpeed's PHP performance is much more efficient than Apache's mod_php or fast_CGI.
# /opt/lsws/fcgi-bin/lsphp -v
PHP 4.4.7 (litespeed) (built: May 30 2007 05:16:33)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
4.1 Download the latest stable PHP
# wget http://in2.php.net/distributions/php-5.2.3.tar.gz
# tar -zxf php-5.2.3.tar.gz
# cd php-5.2.3
# cd sapi
4.2 Download and expand latest LSAPI for PHP into the “sapi” folder:
# wget http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.0.tgz
# tar -zxf php-litespeed-4.0.tgz
4.3 Change directory to php-5.2.3 and run commands:
# cd ..
# touch ac*
# ./buildconf --force
4.4 Configure/Compile PHP:
4.4.a # php -i | grep configure | sed "s/'//g" | sed "s/'//g"
4.4.b # Remove the "--with-apxs=/usr/local/apache/bin/apxs" part from 6.4.a
and add '--prefix=/php5' '--with-litespeed' '--with-config-file-path=../php'
# ./configure '--prefix=/php5' '--with-litespeed'
'--with-config-file-path=../php' --with-mysql ...[append the full options from
4.4.a]
# make
# make install
Note: You must compile PCRE (Perl Compatible Regular Expressions) support in
order for the default auto-index PHP script to work correctly (at least this
is true for 3.0RC2).
4.5 Replace the lsphp binary in /opt/lsws/fcgi-bin/lsphp with /php-5.2.3/sapi/litespeed/php:
# cd /opt/lsws/fcgi-bin/
# mv lsphp lsphp.old
# cp /php-5.2.3/sapi/litespeed/php lsphp
4.6 To check installation success:
# /opt/lsws/fcgi-bin/lsphp -v
PHP 5.2.3 (litespeed) (built: May 31 2007 14:05:12)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
4.7 php.ini
The php.ini file will be located at /opt/lsws/php/php.ini
If we want to use the old PHP.ini just copy it here.
# cd /opt/lsws/php
# mv php.ini php.ini.old
# cp /usr/local/ZEND/etc/php.ini .
4.8 Restart Litespeed Webserver
Finally restart LSWS and use our new PHP binary.
/opt/lsws/bin/lswsctrl restart and thats it. You are done !!!
5. Limitations
This webserver comes as Standard version (which is free and it has several limitations) and it comes as an Enterprise version (which is more optimized and it doesn't have much limitations). Few drawbacks of free version are: the Maximum Concurrent Connections is limited to 150, it cannot utilize more than one processor etc. Hence, to utilize the full advantage of LSWS you have to purchase the Enterprise version.
6. Conclusion
We have installed LiteSpeed Webserver and integrated it to use with CPanel. Now the web pages will load fast. At the same time the server load and memory usage will be lower. More web sites can now be hosted on this server and we can feel the speed. In short, LiteSpeed is the best choice for shared hosting service providers in terms of performance, security and server capacity.
Go ahead, give LiteSpeed a try and discover why over 300,000 internet domains are currently powered by LSWS.
References:
http://litespeedtech.com/
http://en.wikipedia.org/wiki/LiteSpeed_Web_Server/
http://creativeflux.co.uk/entry/replacing-apache-with-litespeed/
http://www.usefuljaja.com/litespeed
Downloads:
http://www.php.net/downloads.php
http://www.litespeedtech.com/products/webserver/lsapi/
Categories for this entry
* Technical Bench » Software Installations - General
* Technical Bench » Webserver
Fuser command
fuser is a UNIX command used to show which processes are using a specified file, file system, or socket.
# To list the process numbers of local processes using the /etc/passwd file, enter:
fuser /etc/passwd
# To list the process numbers and user login names of processes using the /etc/filesystems file, enter:
fuser -u /etc/filesystems
# To terminate all of the processes using a given file system, enter:
fuser -k -x -u -c /dev/hd1
or
fuser -kxuc /home
# To list the process numbers of local processes using the /etc/passwd file, enter:
fuser /etc/passwd
# To list the process numbers and user login names of processes using the /etc/filesystems file, enter:
fuser -u /etc/filesystems
# To terminate all of the processes using a given file system, enter:
fuser -k -x -u -c /dev/hd1
or
fuser -kxuc /home
List the content of a tar file
if You need to list the contents of a tar or tar.gz file on screen before extracting the all files.
List the contents of a tar file
$ tar -tvf file.tar
List the contents of a tar.gz file
$ tar -ztvf file.tar.gz
List the contents of a tar.bz2 file
$ tar -jtvf file.tar.bz2
List the contents of a tar file
$ tar -tvf file.tar
List the contents of a tar.gz file
$ tar -ztvf file.tar.gz
List the contents of a tar.bz2 file
$ tar -jtvf file.tar.bz2
Setup Password protect file via shell
1. Create a file name .htaccess in the folder that you want to password protect with the content below.
AuthType Basic
AuthUserFile /home/username/pass
AuthName "Members Area"
require valid-user
2. In shell, type
/usr/local/apache/bin/htpasswd -c /home/username/pass your_desire_username
You will be prompt for a new password.
3. Enter the password and confirm it.
Once you enter your password, file with name .htpasswd will be created at /home/username directory and now the website folder has been password protected.
4. To add additional users,
/usr/local/apache/bin/htpasswd /home/username/pass your_desire_username
5. To remove users edit /home/username/pass and remove the line contains the username.
More information: http://blog.dreamhosters.com/kbase/index.cgi?area=834
AuthType Basic
AuthUserFile /home/username/pass
AuthName "Members Area"
require valid-user
2. In shell, type
/usr/local/apache/bin/htpasswd -c /home/username/pass your_desire_username
You will be prompt for a new password.
3. Enter the password and confirm it.
Once you enter your password, file with name .htpasswd will be created at /home/username directory and now the website folder has been password protected.
4. To add additional users,
/usr/local/apache/bin/htpasswd /home/username/pass your_desire_username
5. To remove users edit /home/username/pass and remove the line contains the username.
More information: http://blog.dreamhosters.com/kbase/index.cgi?area=834
A memory testing tool
cd /usr/local/src
wget http://pyropus.ca/software/memtester/memtester-4.0.5.tar.gz
tar -zxf memtester-4.0.5.tar.gz
cd memtester-4.0.5
make
./memtester 1024 5 for 1gb(1024 mb) RAM .
The test will be run 5 times.
wget http://pyropus.ca/software/memtester/memtester-4.0.5.tar.gz
tar -zxf memtester-4.0.5.tar.gz
cd memtester-4.0.5
make
./memtester 1024 5 for 1gb(1024 mb) RAM .
The test will be run 5 times.
Subscribe to:
Posts (Atom)