Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Use OpenLiteSpeed as a Reverse Proxy

This guide shows how to make OpenLiteSpeed pass visitors to another app on your server. It needs root access, so it suits a VPS or dedicated server.

Web Hosting2 min read16 steps10 screenshots

What is a reverse proxy?

OpenLiteSpeed is a web server. A web server is the program that sends web pages to visitors. A reverse proxy is a middle person. Visitors talk to OpenLiteSpeed. OpenLiteSpeed then asks another app for the answer and passes it back. It is like a receptionist who takes your question to a colleague in another room.

This is useful for apps such as Node.js, Python or Java, which listen on their own port. A port is a numbered door on the server. For example, your app may listen on port 3000.

Before you start

  • OpenLiteSpeed is installed and running.
  • Your app is running and answers on a local port, such as 127.0.0.1:3000.
  • You can log in to the OpenLiteSpeed WebAdmin console. It usually runs on port 7080. Your login details came when you set up the server.
    backend-image-one

Menu names can vary a little between versions.

frontend-image-one

Steps

1. Add an external app

  1. Open https://your-server-ip:7080 in your browser and log in.
  2. Click Virtual Hosts and choose your site.
  3. Click the External App tab.
    reverse-panel
    web-server-name
  4. Click the Add button.
  5. Set Type to Web Server.
    backend-server-details
  6. Set Name to myapp.
  7. Set Address to 127.0.0.1:3000.
  8. Click Save.

2. Add a context

A context is a rule that says what to do for a path.

  1. Click the Context tab.
  2. Click Add.
  3. Set Type to Proxy. Click Next.
    file-manager
    proxy-server
  4. Set URI to /. This sends the whole site to the app.
  5. Set Web Server to the name you made, myapp.
  6. Click Save.

3. Apply the change

  1. Click the green Graceful Restart button at the top right.
    vhost-server
  2. Visit your website in a browser. You should see your app.
Tip: Use a path such as /api/ as the URI if you only want part of your site to go to the app.

Troubleshooting

  • 502 or 503 error: the app is not running, or the port number is wrong. Check that the app is up.
  • Page not found: check the URI and that the right virtual host is in use.
    rewrite-name
  • Blocked: make sure the firewall allows ports 80 and 443 for visitors. The app port can stay closed to the outside.

For more help, open a support ticket.

Quick recap

  • A reverse proxy passes visitors to another app.
  • Create an External App of type Web Server.
  • Add a Proxy context that points to it.
  • Do a Graceful Restart and test.
    final-image