Jump to: navigation, search

LiquidWeb API Banner.jpg

How to install and configure LiteSpeed 5.0 webserver on cPanel[edit]

To install LiteSpeed 5.0 on a cPanel server, you can use the instructions below. LiteSpeed 5.0 is one of the first webservers to support the HTTP/2 protocol. At this time LiteSpeed 5.0 supports draft 17 of HTTP/2 so things may change in the future, because of this you may want to stick with LiteSpeed 4.2 which does not support HTTP/2 and may be a better choice, depending on your application.

cd /usr/local/src
tar xvf lsws-5.0-ent-x86_64-linux.tar.gz

## If there is a key involved, you will want to create a file with the serial number in it, located in the same directory as ./

cd lsws-5.0

## Paste in the serial number that was given in the email for the license
## More on the options later


How to configure LiteSpeed PHP suEXEC[edit]

If you have installed the LiteSpeed cPanel plugin, you can log into WHM, then go to "Plugins" > "LiteSpeed Web Server Plugin" > "LiteSpeed Configuration" > "PHP suEXEC Quick Configuration".

Once you are at the "PHP suEXEC Quick Configuration" page in WHM you can enable, or disable PHP suEXEC. If you plan on hosting multiple websites and multiple cPanel accounts you should enable suEXEC for increased security. In addition to enabling PHP suEXEC you can also set the limit for "PHP suEXEC Max Conn". Which will set the maximum amount of simultaneous PHP processes that a single user can have running at any given time. You can see in the image below that I've configured LiteSpeed to allow for up to 10 PHP processes to run at once.

Litespeed 5 php suexec configuration.png

I suggest starting with 5 Max Connections and raise this value if you notice poor page load times, or if you get connect / timeout errors with a particular website.

This setting is similar to FCGI MaxProcesses, or PHP-FPM's Max Worker's per pool.

LiteSpeed 5.0 utilizes LSAPI version 6.7 which is slightly faster than FCGI.

Litespeed Webserver Overview[edit]

LiteSpeed is more or less a drop-in replacement for Apache. This can be installed on a cPanel server, and will essentially take over Apache's role. LiteSpeed can be a faster web server than Apache, but a lot of that depends on how you tune apache, if you prefer to not tune anything and want good performance then LiteSpeed is a great option. LiteSpeed integrates with cPanel very well and the integration is handled during the installation process. EasyApache is not effected by LiteSpeed and it can read the httpd.conf file without issue.

The wiki has a lot of guides on how to install LiteSpeed, as well as how to configure the server.

Litespeed webserver Basic Commands[edit]

The install location determines the path, so this might be different depending on the install

/usr/local/lsws/bin/lswsctrl start
/usr/local/lsws/bin/lswsctrl stop
/usr/local/lsws/bin/lswsctrl restart
/usr/local/lsws/bin/lswsctrl reload

Litespeed webserver Install guide[edit]

Basic Install of the trial edition on a cPanel server, should work on CentOS 6.3 through CentOS 6.6

yum check-update
yum update
cd /usr/local/src/
tar xvfz lsws-4.2.23-ent-x86_64-linux.tar.gz
cd lsws-4.2.23
mv trial.key lsws-4.2.23
cd lsws-4.2.23
service httpd stop
chkconfig httpd off

Some questions that were asked during installation. If you are installing LiteSpeed on a new server with no exisiting websites, I suggest using "0" for the port offset. This will replace Apache with LiteSpeed. You can always switch back and forth between LiteSpeed and Apache later on.

Would you like to run LiteSpeed along side with Apache on another port
to make sure everything work properly? If yes, please set "Port Offset"
to a non-zero value, LiteSpeed will run on Port 80 + "Port Offset",
otherwise, set to "0" to replace Apache.

Port Offset [2000]? 0

If you plan on running multiple websites and multiple cPanel users you will want to enable PHP suEXEC so that LiteSpeed can fork PHP processes as needed. By enabling PHP suEXEC you will increase server security by running each PHP process as the user that owns the file. LiteSpeed takes advantage of the SuEXEC Daemon which forks new PHP processes as needed, LiteSpeed also utilizes opcode caching for PHP.

PHP suEXEC will run php scripts of each web site as the user who own the
document root directory,
LiteSpeed PHP suEXEC does not have any performance penalty like other PHP
suEXEC implementation, and .htaccess configuration overriden has been fully

Note: You may need to fix some file/directory permissions if phpSuexec or
suphp was not used with Apache.

Would you like to enable PHP suEXEC?
    0. No
    1. Yes
    2. Only in user's home directory (DirectAdmin should use this)

Please select (0-2)? [2]1
Would you like to have LiteSpeed Web Server started automatically
when the server restarts [Y/n]?
when the server restarts [Y/n]? Y

[OK] The startup script has been successfully installed!
The default configuration file contain support for both PHP4 and PHP5,
A prebuilt PHP4 binary comes with this package, however, we recommend
you to build your own PHP4 and PHP5 binaries though our web console with
the same configuration parameters as your current PHP installation. You
can check your current PHP configuration via a phpinfo() page.

Press [ENTER] to continue
When you replace Apache with LiteSpeed, remember to stop Apache completely.
On most Linux servers, you should do:

    service httpd stop
    chkconfig httpd off
    service apache stop
    chkconfig apache off

If "Port Offset" has been set to "0", you should do it now.

Press [ENTER] to continue

Litespeed webserver Post Install firewall configuration[edit]

  • You might need to open port 7080 to access the Web Configuration via cPanel
  • LiteSpeed suggests the following Kernel tweaks to improve performance:
vim /etc/sysctl.conf


#increase local ports
net.ipv4.ip_local_port_range = 1024 65535

#reduce the number of time_wait connections
#these 3 lines can reduce your time_wait count by several hundred percent.
#however you should not use the following lines in a NATed configuration.
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
  • To apply the changes:
sysctl -p