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
|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
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Configure OpenLiteSpeed as reverse proxy step by step instructions
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.
- 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.
- Next, navigate to the ‘Server Configuration’ tab on the left side, then click on the ‘External App’ tab as seen in the screenshot below.
- 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.
- 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
Save your changes when done.
- 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.
- Now we can configure a page to forward to the backend web server.
- 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.
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.
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.