OpenLiteSpeed as reverse proxy

In this tutorial, you will learn how to configure OpenLiteSpeed as a reverse proxy server. A system that sits between a client and a web server (or servers) can be configured as a reverse proxy. The proxy service acts as a frontend and works by handling all incoming client requests and distributing them to the backend web, database, and/or other server(s). The advantages of a reverse proxy become most apparent under high traffic conditions or situations where multiple backend servers are deployed and need some form of load balancing.

Follow along with us below as we take you through the step by step instructions to configure OpenLiteSpeed as a reverse proxy server on a Linux system. OpenLiteSpeed can act as our central point for incoming connections and provide us with load balancing, central logging, improved security, and better performance. We will set up OpenLiteSpeed as a reverse proxy for our Apache backend in the steps below.

In this tutorial you will learn:

  • How to configure OpenLiteSpeed as reverse proxy server
  • How to proxy content based on URL context
  • How to proxy content based on file extension
OpenLiteSpeed default password
OpenLiteSpeed default password
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Debian Linux or Red Hat Enterprise Linux based Linux distro
Software OpenLiteSpeed web server; Backend server such as Apache
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Configure OpenLiteSpeed as reverse proxy step by step instructions



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!


The first thing you will need to do is install the OpenLiteSpeed web server, if you do not already have it on your system. Please refer to our OpenLiteSpeed installation guide to get the software installed, then return to follow the instructions below when finished.

  1. Get started by navigating to the OpenLiteSpeed web admin panel located at https://localhost:7080/login.php and log in with your admin user name and password. In case you have not yet configured one, see our guide on OpenLiteSpeed default password.
    Log in to the OpenLiteSpeed web admin
    Log in to the OpenLiteSpeed web admin
  2. Next, navigate to the ‘Server Configuration’ tab on the left side, then click on the ‘External App’ tab as seen in the screenshot below.
    Editing the external app settings within the server configuration section
    Editing the external app settings within the server configuration section
  3. Add a new external app by clicking on the plus sign to the right. Choose what type of app you want to add. In this case, we will add a backend web server.
    Choose the type of external app to add
    Choose the type of external app to add
  4. Start filling out the details of your app. Pick a memorable name as this will be used again in other places through OpenLiteSpeed. Make sure you configure the web address correctly, as this will be where OpenLiteSpeed will forward incoming connections. In our example, we are running an Apache server on port 8080, so we will configure our address as localhost:8080.
    Fill out the settings for your external app
    Fill out the settings for your external app

    Save your changes when done.



  5. Next, we have to choose how OpenLiteSpeed should determine what traffic to send to the external app (backend web server in our case). One option is to choose to proxy by Context, which basically means that we can configure specific pages to be sent as requests to the external app. This can be configured in Virtual Hosts > Context. Then, choose ‘Proxy’ as your type.
    Configuring proxy via context in OpenLiteSpeed
    Configuring proxy via context in OpenLiteSpeed
  6. Now we can configure a page to forward to the backend web server.
    Configuring where to send a URL via proxying by context
    Configuring where to send a URL via proxying by context
  7. Another option is to proxy by script handler. This allows you to configure certain types of content to proxy. Get started by navigating to Server Configuration > Script Handler.
    Configuring proxy via script handler in OpenLiteSpeed
    Configuring proxy via script handler in OpenLiteSpeed

    Now you can choose what types of content you want to proxy, by specifying their file type. In the screenshot, we are proxying all PHP files.

Closing Thoughts




In this tutorial, we saw how to configure OpenLiteSpeed as a reverse proxy server on a Linux system. Unlike many other types of reverse proxy servers, OpenLiteSpeed makes the process very easy through use of the administrator web panel and helpful prompts along the way. Now you may proxy your content based on URL or file type. For more intricate proxy rules, you can configure a separate virutal host.



Comments and Discussions
Linux Forum