How to: Plesk + Litespeed + Docker Reverse Proxy

Docker Proxy Rules in Plesk is ONLY supported by Nginx. Since Litespeed requires Nginx to be disabled (it’s replacing it’s functionality) we clearly can’t use the highly convenient Docker Proxy Rules.

However, there is a way in which we can setup Litespeed to work as a reverse proxy for a domain/subdomain in Plesk. Also, it’s very straight forward to achieve this setup. I’ve detailed a guide on how you would go about this, of course, you’ll need to adjust the settings as per your installation.

Not only is a proxy needed in many circumstances, but by using a reverse proxy you can take advantage of higher-level functions such as automated Let’s Encrypt certificates being installed. Or if using a subdomain, you could apply the wildcard certificate for the main domain and enjoy it all auto-updating together. Basically set and forget! 🙂

Step 1

Login to WebAdmin Console.

Now click Add under External App.

Now change the Type to Web Server, don’t worry it’s actually the proxy we were looking for! Now, lets set up the configuration, here I am calling the external app dock-openproject since I am creating this to proxy a docker based instance of OpenProject.

That’s it for the first step!

Step 2

If you haven’t already prepared the domain/subdomain, then please create it.

Click Apache & nginx Settings. What we’re looking to do is add the rewrite directives needed to forward the requests to the external app we just created.

HTTP:

RewriteEngine On
REWRITERULE ^(.*)$ HTTP://dockopenproject/$1 [P]

HTTPS:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
REWRITERULE ^(.*)$ HTTP://dock-openproject/$1 [P]

And that’s it! Really nothing to it, except remembering that you’ve made manual configuration changes. Of course, also don’t forget to block off firewall access to the docker instance from the outside world just incase.