How to use LiteSpeed with cPanel/WHM

cPanel is one of the most popular web hosting control panels used by web hosting companies. cPanel uses Apache web server and depends on many Apache features. LiteSpeed web server is designed to be Apache interchangeable as a drop-in replacement. Since 2.2.5 release, LiteSpeed Web Server works very well with cPanel managed web sites.

You will get many benefits by replacing Apache with LSWS, web pages get loaded faster, server load is lower and memory usage is lower. More web sites can now be hosted on the same server.

This wiki will address some commonly used features for your LiteSpeed Web Server/WHM installation. The installation process is covered in our auto-installer wiki.

Note: For free support of LSWS please use the LiteSpeed forum. If you have an issue with cPanel (even while using LSWS) please contact cPanel support. They are fully trained to handle LiteSpeed Web Server.

To turn on directory auto index, just change “Index Files” configuration

 Auto Index => Yes
 Auto Index URI => /_autoindex/default.php

If PHP open_base dir option has been enabled, you may get an error like

Warning: Unknown(): open_basedir restriction in effect. 
File(/usr/local/lsws/share/autoindex/default.php) is not within the allowed path(s): 
(/home/lsws:/usr/lib/php:/usr/local/lib/php:/tmp) in Unknown on line 0
Warning: Unknown(/usr/local/lsws/share/autoindex/default.php): 
failed to open stream: Operation not permitted in Unknown on line 0

You need to add directory “/usr/local/lsws/share/autoindex” to the open_basedir list, or move dirtory “/usr/local/lsws/share/autoindex” to “/usr/lib/php/autoindex”, then create a symbolic link from “/usr/lib/php/autoindex” to “/usr/local/lsws/share/autoindex”.

mv /usr/local/lsws/share/autoindex /usr/local/lib/php
ln -sf /usr/local/lib/php/autoindex /usr/local/lsws/share/autoindex

There are some rarely used Apache features which are not supported by LSWS, like full “mod_perl” functionalities, mod_svn, etc., don't worry, LSWS can forward requests to Apache running behind LSWS. For example, to forward request of svn pages to Apache, do the following:

  1. Listening port of apache should be changed to 79 for HTTP and 442 for HTTP.
  2. “Apache Port Offset” configuration in LSWS should be changed to “1”, so LSWS will use port 80 and 443.
  3. If you want to have apache handle request with certain URL prefix, for example, a svn repository under URI “/svn/”, Set “Apache Handled Content” configuration to “/svn/”, this will off load all request to /svn/* to backend Apache.

:!: Make sure “Port” directive has been changed to the port being used.

Restart Apache and LSWS, svn pages should be served by backend Apache now.

To make FrontPage Extension work properly with LSWS, you need to change the ownership and permission of public_html/_vti_pvt/service.pwd for each account. service.pwd was owned by $user:$user with permission of 0600, you need to change it to $user:nobody with permission of 0640.

To fix the permission, administrator must execute two shell commands only once, if those changes are overwritten later by cPanel updates, you need to execute it again. (those are contributed by one of our users)

sed -rie 's/(safe_)?chmod\(( )?0600,( )?("\$\{myuid\}",)?( )?"\$(\{)?homedir(\})?\/public_html\$\{subweb\}\/_vti_pvt\/service.pwd"( )?\);/\1chmod(\20644,\3\4\5"$\6homedir\7\/public_html${subweb}\/_vti_pvt\/service.pwd"\8);/' /scripts/fp-auth /usr/local/frontpage/version5.0/apache-fp/fp-auth /usr/local/cpanel/bin/convertfppassthrough /scripts/fixfrontpageperm



If above commands is too much for you, just change the ownership and permission of service.pwd one by one with following command as root:

 chgrp nobody service.pwd
 chmod 0640 service.pwd

When LiteSpeed Standard Edition is used together with hosting control, when using Apache httpd.conf, it can only import the top five <VirtualHost …> configuration sections based on the order in httpd.conf. So, if your web site shows the control panel welcome page, it means the limit has been hit, you should upgrade to our Enterprise Edition.

  • Admin
  • Last modified: 2015/07/20 18:36
  • by Michael Alegre