Strapi on OpenLiteSpeed


Published on : October 8, 2020

Last updated on : June 3, 2021

What were you thinking?

Well, as explained in this other article about my Jamstack conversion, I already had OpenLiteSpeed installed on my server.

I did not want to start from scratch with another server or use a hosting service like Netlify (I know, not very Jamstack-y).

Is it hard?

In retrospect, not really.

Why make an article then? Well because at the time, I had a very hard time finding documentation about OpenLiteSpeed. I noticed they greatly enhanced their doc since then, nice job!

The interesting part

Deploying Strapi

I’m not going to write a deployment guide for Strapi as they already have in their documentation. I followed the Digital Ocean guide and set up Strapi, the database and pm2. I ignored the part about Nginx and allowing port 1337 although it can be useful for testing.

Virtual host configuration

Here is the not so tricky part:

  • login into your admin panel, usually accessible on port 7080 (your.ip.address:7080)
  • add a new virtual host (ex: 'strapi')
  • the Document Root does not matter, I set it to a folder containing an empty html file
  • set the Domain name to your strapi domain
  • in the External App tab, add a new 'Web Server'

Give it an obvious name, use the default Strapi address and port for the 'address' field:

  • In the Context tab, add a new 'Proxy' context

Use the root / for the 'URI' field and select your previously created web server form the list below. I added some cache headers in the 'Header Operations' field:

unset Cache-control
set Cache-control public, max-age=15552000

I allowed access to everyone with * and told the server to use utf-8 as the default charset encoding (it never hurts).

Listener configuration

On the listeners window bind your virtual host to both http and https (ssl) listeners.

It’s a pretty straight forward process. Or so I thought.

I encountered some trouble when trying to serve both ipv4 and ipv6 trafic due to the lack of documentation (or bad SEO?). Anyway here is how to listen to both on the same listener, even though LiteSpeed now recommends to use separate listeners.

On the 'Address Settings', choose [ANY] IPv6 for the 'IP Address' field. The 'Port' field depends on http/https (80/443).

On the 'Virtual Host Mappings', add a new host and choose your Strapi virtual host from the drop-down. In order to listen to ipv4 and ipv6, we need to specify both and use a particular syntax for the ipv4 by prepending it with ::FFFF: as such: domain.tld, ::FFFF:IPV4, IPV6

We’re done! Strapi should be accessible through its domain. Don’t forget to perform a 'graceful restart' of OpenLiteSpeed and close port 7080 when you’re done with the admin panel.


I know right! But why bother when you could configure an nginx proxy? Well when you never have it’s far from easy and even though there are plenty of articles I always find myself failing because of a lack of information. For instance, Strapi deployment doc only says “you will need to install NGINX and configure it”. That’s it. Even the link provided does not explain how to configure a proxy.

At least OpenLiteSpeed has a graphical interface 😬