# OpenLiteSpeed 1.9.4 Won’t Start on DirectAdmin (Exit 127): ModSecurity Fix

Source: https://srvscripts.com/guides/openlitespeed-1-9-4-directadmin-modsecurity-exit-127/
Updated: 2026-11-05
Publisher: srvScripts (https://srvscripts.com/)

If you updated OpenLiteSpeed to 1.9.4 on a DirectAdmin server, through CustomBuild or with LiteSpeed’s `lsup.sh`, and every site went down straight after, you are probably hitting the same packaging problem we hit on a production server: the 1.9.4 ModSecurity module cannot load, and the server stops before it writes a single log line. This guide shows how to confirm it, the quick fix, a way to keep ModSecurity on, and a related problem many DirectAdmin + OpenLiteSpeed servers have without knowing it: the Imunify360 WAF rules never load.

**Short answer:** The OpenLiteSpeed 1.9.4 `mod_security.so` (package built 28 October 2026) needs 30 Lua functions but does not link a Lua library, so the server exits with status 127 as soon as it loads the module. Comment out `include /etc/openlitespeed/httpd-modsecurity-enable.conf` to get your sites back, or preload LuaJIT with `LD_PRELOAD=/usr/lib64/libluajit-5.1.so.2` in a systemd drop-in to keep ModSecurity on. Separately, check `/etc/modsecurity.d/I360_RULESET`: if it says `imunify360-minimal-apache`, the Imunify360 WAF rules are not loading on OpenLiteSpeed at all. (Reviewed November 2026.)

## Symptoms

- `systemctl status openlitespeed` shows `[OK] litespeed: pid=…` and then `Main process exited, code=exited, status=127/n/a` a few seconds later.

- Nothing about the failure in `/var/log/openlitespeed/error_log`.

- `/usr/local/lsws/logs/lsrestart.log` repeats `LSWS does not restart properly, check port 7080`.

- `ldd /usr/local/lsws/bin/openlitespeed` reports no missing libraries.

- After CustomBuild has reinstalled OpenLiteSpeed, `/usr/local/lsws/admin/misc/lsup.sh -p` answers `Can not get the right version for installation, quit.`, because the previous install directory is gone.

Exit status 127 usually means “command not found”. Here the dynamic loader uses it: a module the server loads at start-up refers to functions that nothing provides, so the process is stopped on the spot.

## Back up the current install first

`/usr/local/lsws` is a symlink to a directory with a random suffix (for example `lsws-AbC1`), and `./build openlitespeed` deletes the old directory when it installs a new one. Back up the real directory, not the symlink, before you change anything. The archive should be roughly 90 MB; a file of a few hundred bytes means you only saved the link.

```
tar -czf /root/lsws-$(date +%F-%H%M).tgz -C /usr/local "$(readlink /usr/local/lsws)"
ls -lh /root/lsws-*.tgz
```

## Confirm the cause

```
/usr/local/lsws/bin/openlitespeed -v | head -6
nm -D /usr/local/lsws/modules/mod_security.so | grep -cE ' U (lua_|luaL_)'
readelf -d /usr/local/lsws/modules/mod_security.so | grep NEEDED
```

On the affected package, the version line shows `LiteSpeed/1.9.4 Open (BUILD built: Wed Oct 28 …)` with `mod_security 1.4 (with libmodsecurity v3.0.15)`. The second command prints **30**: the module needs 30 Lua functions. The NEEDED list contains only system libraries (libpthread, librt, libcrypt, libm, libc), so no Lua library is loaded to provide them. The 1.9.3 module we compared (built 30 September 2026) needs none.

## Quick fix: start 1.9.4 without ModSecurity

This gets the sites back in seconds. It only switches off the ModSecurity module; the rest of the configuration is untouched.

```
C=$(readlink -f /usr/local/lsws/conf/httpd_config.conf)
cp -p "$C" "$C.bak.$(date +%s)"
sed -i 's|^include /etc/openlitespeed/httpd-modsecurity-enable.conf|#include /etc/openlitespeed/httpd-modsecurity-enable.conf|' "$C"
systemctl restart openlitespeed; sleep 3; systemctl is-active openlitespeed
```

What you lose is server-level ModSecurity filtering. Before you treat that as a big loss on OpenLiteSpeed, read the Imunify360 section below: on our server those rules turned out not to have been loading for months.

## Keep ModSecurity on: preload LuaJIT

The functions the module asks for include `lua_objlen` (which exists only in the Lua 5.1 API) together with `luaL_setfuncs` (which plain Lua 5.1 does not have). That combination is LuaJIT 2.1. On AlmaLinux 8 the `luajit` package (from EPEL) provides every one of them. Check against your own module before you try anything:

```
rpm -q luajit || dnf install -y luajit
nm -D /usr/local/lsws/modules/mod_security.so | awk '/ U (lua_|luaL_)/{print $2}' | sort > /root/modsec-lua-needs.txt
nm -D /usr/lib64/libluajit-5.1.so.2 | awk '$2~/^[TW]$/{print $3}' | sort | comm -23 /root/modsec-lua-needs.txt -
```

**Continue only if the last command prints nothing.** On our server Lua 5.3 lacked `luaL_loadfile`, `lua_objlen` and `lua_pcall`, and preloading it stopped the server again. The test below turns ModSecurity back on with LuaJIT preloaded and reverts on its own if the site is not answering within six seconds. Replace `example.com` with a domain hosted on the server.

```
cat > /root/ols-luajit-test.sh
