If you are looking for a fast webserver, stop searching and take a look at LiteSpeed Webserver. It is an apache emulator with high performance. It can double the server speed at the same time reduce the server load by half. LiteSpeed has now powered some of the world's popular websites like Wordpress.Com, AirLiners.Net (both having 30+ millions hits per day). LiteSpeed Web Server is the core product of LiteSpeed Technologies Inc. The web server survey conducted on 2006 shows that LiteSpeed powers over 3,00,000 domains and is the 6th most popular web server platform in the world.
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
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 : 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
- 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
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
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
# 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
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 !!!
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.
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.
About the author:
Divya Jithin works as Sr. Software Engineer (Grade II) in Bobcares.com. She has worked in Bobcares for over 3 years and mainly specializes on Linux server administration.