Complete Step by Step Install OpenLiteSpeed

How Can We Help?
< Back
You are here:
Print

Step by Step Complete OpenLiteSpeed Install

In this guide we’ll show you how to install OpenLiteSpeed completely and easily step by step. By following this guide you won’t have to go to any other install links or anywhere else. Just follow it step by step and we’ll show you how to install OpenLiteSpeed including php and everything.

The purpose of this guide is to have all the installation instruction in one place. But if you have different requirements you can explore other option in our knowledge-base installation section. At the end of this guide you will have OpenLiteSpeed web server ready to host your amazing websites. Without further due lets start!.

We are performing the following steps on a fresh CentOS 7.5.

Step 1: Install OpenLiteSpeed

In this guide, we’re installing OLS from LiteSpeed repositories.

Add LiteSpeed Repository for CentOS

Use the following commands to add our CentOS repositories:

Add EPEL Repository

yum install epel-release

CentOS 6: rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm

CentOS 7: rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm

CentOS 8: rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

Add LiteSpeed Repository for Debian

Debian 7, 8 & Ubuntu 14,16,18,20 : wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash

Install OpenLiteSpeed:

For CentOS:

yum install openlitespeed

For Debian & Ubuntu:

apt-get install openlitespeed

The above command installs the latest version of OpenLiteSpeed. You can also specify version numbers, for example yum install openlitespeed-1.6.14, will install older versions. 1.6.14 is the oldest version in the repository.

Note: The OpenLiteSpeed packages in our repositories have SPDY enabled. The binary also includes the OpenSSL library needed to run SPDY. You do not have to install OpenSSL 1.0.1 to use SPDY if you download the package from the repositories.

OpenLiteSpeed web server has been installed successfully now.

Default OLS installation directory is: /usr/local/lsws

To start the server, simply run /usr/local/lsws/bin/lswsctrl start. (To stop it, run /usr/local/lsws/bin/lswsctrl stop.)

A sample site should be running on the server. To access your site, point your browser to http://[address]:8088/, [address] being the IP address or domain name of your web server machine. Use “localhost” if the server is on the machine you are using. By default, OpenLiteSpeed runs on port “8088”.A congratulations page linked to other testing pages should load into the browser when pointed to the above address. If not, try testing the WebAdmin interface.

The default port for the WebAdmin console is 7080. Plug https://[address]:7080/, into your browser to go to the WebAdmin interface.

Remember the “https://” and that for [address] you can use “localhost” if you’re currently using the machine the server is on.

A login page should load. The defaults for the administrator’s user name and password are “admin” and “123456”.

Step 2: Install PHP for OLS

In this guide, we’ll be installing PHP from the LiteSpeed repository. You can use other methods too that are mentioned in our knowledge base.

Once you’ve added our repository, you can use yum to install PHP for LiteSpeed with a variety of modules. The following command will install LSPHP 5.6:

yum install lsphp56 lsphp56-common lsphp56-mysql lsphp56-gd lsphp56-process lsphp56-mbstring lsphp56-xml lsphp56-mcrypt lsphp56-pdo lsphp56-imap lsphp56-soap lsphp56-bcmath

Similary, if you wish to install php 7.0 or 7.2 etc simply replace 56 above with 70 or 72 and it will install PHP 7.0 or PHP 7.2 version respectively.

The LiteSpeed Repository automatically installs PHP to /usr/local/lsws/lsphp5x/bin/lsphp where 5x is the version and subversion. Thus PHP 5.6 would be installed to /usr/local/lsws/lsphp56/bin/lsphp.

Now you will have folders of lsphp56 under: /usr/local/lsws/  .

Optional:

if you want to install all available php versions from php 5.2 to php 7.2 then use this command:

yum groupinstall lsphp-all

These PHP builds are installed to the following locations based on version number:

/usr/local/lsws/lsphp52/bin/lsphp
/usr/local/lsws/lsphp53/bin/lsphp
/usr/local/lsws/lsphp54/bin/lsphp
/usr/local/lsws/lsphp55/bin/lsphp
/usr/local/lsws/lsphp56/bin/lsphp
/usr/local/lsws/lsphp70/bin/lsphp
Define External App for these PHPs

We will go through creating an external application for PHP 5.6. The default external applications can also be used with some modification.

Add an external application (in the WebAdmin console > Server Configuration > External App > Add).

Choose LiteSpeed SAPI App for the application type.

Give the new external application an appropriate name, address, maximum number of connections, initial response timeout, and retry timeout.

The most import setting is the Command setting. This tells the external application where to look for the PHP it will use. Direct it to one of your PHP installations.

Setup script handlers

Script handlers will tell OpenLiteSpeed which scripts should go to which external application. There are many ways to configure this. You can, for example, stipulate different suffixes to be served by different external applications. We will be setting up a script handler at the virtual host level to tell OpenLiteSpeed that .php scripts in this virtual hosts should be served with our new lsphp56 external application. This will override any server-level script handler settings. Context-level setting can be used to override server- or virtual host-level settings.

Add a virtual host-level script handler (WebAdmin console > Virtual Hosts > Example > Script Handlers > Add).

Choose the suffix this script handler will handle, make the Handler Type LiteSpeed SAPI, and direct it toward the external application you just created.

Graceful restart to save your changes.

 

OpenLiteSpeed will now serve .php scripts in the virtual host with PHP 5.6. You can repeat these processes for any other PHP builds you’d like to support.

For installing PHP for OLS using Remi Repository in Ubuntu/Debian please refer to THIS URL and check the Ubuntu/Debian section half way down the page.

Step 3: Check Your PHP Installation

You can check that your PHP installation is correct by viewing a phpinfo() page. The phpinfo() page should show the correct version of PHP and LiteSpeed as the server API.

To check this, you should go to the URL:  http://[hostname]:8088/phpinfo.php   where the hostname name can be your server hostname e.g  server1.domain.com or your server IP address.

You can repeat Step 2 to install PHP 7.2 or any version number.

Step 4: Change PHP version your OLS server is using (optional)

Now if you also installed PHP 7.2 by performing Step 2, then you can easily change your PHP version your OLS server is using if you wish to change so.

Goto: WebAdmin Console-> Server Configuraiton -> Script Handler  and edit the default script handler you see there.

And change the Handler name to lsphp72 and save.

Perform a graceful server restart.

Now you’ll see that your OpenLiteSpeed server is using PHP 7.2 version.

Thats it!. Your OpenLiteSpeed server is now ready to use and host your websites. 🙂

Feel free to ask any question you may have in our support forum.

 

Debug

If your server uses a firewall, please make sure that localhost is trusted.
For instance, Linux with IPTables should include a rule ALLOW INPUT from LO.
If your website and the WebAdmin console are inaccessible, please take a look at the error log /usr/local/lsws/logs/error.log.
If there is a TCP port conflict with other server applications, you will need to stop the application currently running on port 7080. The following command can be used to check port 7080: netstat -an | grep 7080. If the port is available, the command will produce no output.
If the swapping directory is not writable, you can either grant writing permission for the swapping directory to the user whom the web server is running as, or change the swapping directory’s configurations manually. The swapping directory is configured in the server’s XML configuration file: /usr/local/lsws/conf/httpd_config.xml. Search the XML file for “swappingDir”. The default location for the swapping directory is /tmp/lshttpd/swap.
If you still have problems with installation, please check the OpenLiteSpeed Development Group.