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
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
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.
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
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.
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
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.