Emergency server help: get in touch

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

OpenLiteSpeed 1.9.4 exits with status 127 on DirectAdmin because its mod_security.so needs Lua functions it does not link. Quick fix, LuaJIT workaround, and why Imunify360 WAF rules do not load on OpenLiteSpeed.

Published 9 min read

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 <<'EOF'
set -u
C=$(readlink -f /usr/local/lsws/conf/httpd_config.conf)
D=/etc/systemd/system/openlitespeed.service.d
cp -p "$C" "$C.bak.$(date +%Y%m%d-%H%M%S)"
mkdir -p "$D"
printf '[Service]\nEnvironment=LD_PRELOAD=/usr/lib64/libluajit-5.1.so.2\n' > "$D/lua-preload.conf"
sed -i 's|^#include /etc/openlitespeed/httpd-modsecurity-enable.conf|include /etc/openlitespeed/httpd-modsecurity-enable.conf|' "$C"
systemctl daemon-reload; systemctl restart openlitespeed; sleep 6
CODE=$(curl -s -o /dev/null -w '%{http_code}' --resolve example.com:443:127.0.0.1 https://example.com/)
if systemctl is-active -q openlitespeed && [ "$CODE" = 200 ]; then
  echo "OK: running with ModSecurity + LuaJIT"
else
  echo "FAILED ($CODE) - reverting"
  sed -i 's|^include /etc/openlitespeed/httpd-modsecurity-enable.conf|#include /etc/openlitespeed/httpd-modsecurity-enable.conf|' "$C"
  rm -f "$D/lua-preload.conf"; systemctl daemon-reload; systemctl restart openlitespeed
fi
EOF
bash /root/ols-luajit-test.sh

To undo it later, comment the include again and remove the drop-in:

C=$(readlink -f /usr/local/lsws/conf/httpd_config.conf)
sed -i 's|^include /etc/openlitespeed/httpd-modsecurity-enable.conf|#include /etc/openlitespeed/httpd-modsecurity-enable.conf|' "$C"
rm -f /etc/systemd/system/openlitespeed.service.d/lua-preload.conf
systemctl daemon-reload; systemctl restart openlitespeed

This is an unofficial workaround until LiteSpeed or DirectAdmin ship a corrected package. LD_PRELOAD applies to every process OpenLiteSpeed starts, including the lsphp workers; that was harmless in our tests, but remove the drop-in as soon as a fixed module is available.

Check whether your Imunify360 WAF rules actually load

Getting the module to load is not the same as getting rules to load. After the LuaJIT fix, check the log straight after a restart:

grep 'setSecRule' /var/log/openlitespeed/error_log | tail -3
cat /etc/modsecurity.d/I360_RULESET; echo; cat /etc/modsecurity.d/RELEASE; echo
ls -l /var/log/openlitespeed/modsec_audit.log*

These are the errors we saw on Imunify360 8.15.1, in the order they appeared as each one was cleared:

  • On 1.9.3: Rules error. File: /etc/modsecurity.d/000_i360_init.conf … Failed to load script: Lua support was not enabled.
  • On 1.9.4 with LuaJIT: Failed to compile script 'trap.lua: cannot open trap.lua: No such file or directory. The rule names the script without a path, and libmodsecurity v3 looks for it in the server’s working directory rather than next to the rules.
  • After giving the scripts a full path: Expecting a variable, got: SCRIPT_FILENAME. That variable exists only in ModSecurity v2.

The reason is in I360_RULESET and RELEASE: imunify360-minimal-apache, "modsec_version": 2, "webserver": "Apache". OpenLiteSpeed uses libmodsecurity v3, which rejects the whole rule file at the first v2-only directive, so none of the Imunify360 WAF rules load. An empty modsec_audit.log for months confirms it: ours had been empty since early December 2025. Imunify360’s installation guide lists Apache, LiteSpeed (Enterprise, 5.1 or later) and Nginx as supported web servers; OpenLiteSpeed is not on the list, which is why the agent installs the Apache rule set. Fixing the rule files line by line is not worth it: more v2-only rules follow, and the next Imunify360 rule update overwrites the files.

What still protects you

  • Imunify360 WebShield, Proactive Defense, malware scanning, the firewall and DoS protection all work independently of ModSecurity.
  • The Imunify Security WordPress plugin runs its own WAF inside WordPress. Make sure it is active on every WordPress site on the server; on OpenLiteSpeed it is doing the job you probably thought ModSecurity was doing.

Options for a server-level WAF on OpenLiteSpeed

  • Ask Imunify360 support whether a ModSecurity v3 rule set is available for DirectAdmin with OpenLiteSpeed.
  • Use the OWASP Core Rule Set through CustomBuild (modsecurity_ruleset=owasp). Plan it first: keep the Imunify360 v2 files out of the same rule include, and test the WordPress admin, because the Core Rule Set needs WordPress exclusions to avoid false positives.
  • Move to LiteSpeed Enterprise, which Imunify360 supports with its full rule set (paid licence).

When a fixed 1.9.4 package ships

CustomBuild installs updates only when you run it if updates=no is set, so check that first:

grep -E '^(updates|cron)=' /usr/local/directadmin/custombuild/options.conf
cd /usr/local/directadmin/custombuild && ./build update && ./build versions | grep -i openlitespeed

After installing a newer package with ./build openlitespeed (take the backup above first), repeat the symbol check. If it prints 0, the module no longer needs the workaround:

nm -D /usr/local/lsws/modules/mod_security.so | grep -cE ' U (lua_|luaL_)'
rm -f /etc/systemd/system/openlitespeed.service.d/lua-preload.conf
systemctl daemon-reload; systemctl restart openlitespeed; systemctl is-active openlitespeed

On DirectAdmin, update OpenLiteSpeed with CustomBuild rather than lsup.sh, so the install stays in the layout DirectAdmin manages. As shown above, lsup.sh -p cannot roll back once CustomBuild has replaced the install directory, so the tar backup is your real rollback.

Frequently asked questions

Why is there nothing in error_log when it fails?

The process is stopped by the dynamic loader while OpenLiteSpeed loads mod_security.so, before the server has opened its log. The only traces are the exit status 127 in systemctl status and the “LSWS does not restart properly” lines in /usr/local/lsws/logs/lsrestart.log.

Does “check port 7080” mean the admin panel is the problem?

No. lswsctrl prints that generic hint whenever the server does not come up. Nothing on port 7080 was wrong in our case; the module failed to load.

Does turning ModSecurity off switch off Imunify360?

No. WebShield, Proactive Defense, malware scanning, the firewall and the Imunify Security WordPress plugin keep working. On OpenLiteSpeed, also check /etc/modsecurity.d/I360_RULESET: if it says imunify360-minimal-apache, the Imunify360 ModSecurity rules were probably not loading before the update either.

Can I copy the 1.9.3 mod_security.so into the 1.9.4 install?

Do not. The server binary and its modules are built as a matched pair. Mixing versions can crash the server in ways that are harder to diagnose than this one. Use the preload workaround or wait for a fixed package.

Related: Imunify360 install, licence and uninstall commands · Tune LiteSpeed for high-traffic WordPress · Linux server log file locations · Security Bulletin

Tested on one production server: DirectAdmin 1.713, AlmaLinux 8.10, OpenLiteSpeed 1.9.4 from CustomBuild (package built 28 October 2026), Imunify360 8.15.1, LuaJIT 2.1.0-beta3, 5 November 2026. The LuaJIT preload is a workaround we ran in production; the Imunify360 rule results are from the same server.

Share this guide

Free website test

Is your website set up right?

Check SSL, security headers, redirects, robots.txt, sitemap, llms.txt and security.txt in one test. It takes about 30 seconds.