Apache .htaccess compatibility module for OpenLiteSpeed, plus the litehttpd-confconv Apache-to-OLS config converter.
| LiteHTTPD-Thin | LiteHTTPD-Full | |
|---|---|---|
| What | litehttpd_htaccess.so module only |
Module + Patched OLS (3 patches) |
| Install on | Stock (unmodified) OLS | Custom-built OLS (v1.9.5) |
| Install time | 1 minute | 10-15 minutes |
| Directives | 120 (security, headers, caching, conditionals, redirects, native PCRE2 RewriteRule, ESI, 5D BotChallenge + Rust ALTCHA v1, RateLimit, Options -Indexes, Require expr/<RequireNone>/AuthGroupFile, AllowOverrideList) |
120 (adds OLS native RewriteEngine, per-request php_value/php_flag, readApacheConf, static zstd 1.5.7, libmodsecurity 3.0.17) |
| Best for | Quick .htaccess support, Docker, evaluation | Full Apache migration, WordPress with advanced plugins |
LiteHTTPD-Thin works on any stock OLS -- just copy the .so and restart. All 120 security, header, caching, ESI, 5D BotChallenge + ALTCHA v1, RateLimit, Options -Indexes, Require expr/<RequireNone>/AuthGroupFile, AllowOverrideList, and built-in PCRE2 RewriteRule directives work immediately (php_value falls back to LSAPI env variables where supported).
LiteHTTPD-Full compiles OLS v1.9.5 with 3 patches (0001–0003), static libzstd 1.5.7 (-DWITH_ZSTD=ON, zstdAutoUpdateStatic 1), libmodsecurity 3.0.17, pure-std Rust litehttpd-core (statically linked ABI v3: ALTCHA v1, ESI + RFC 9112 chunked dynamic HTTP, ap_expr, unified crypto & Basic Auth/$apr1$/{SHA}, BotChallenge parsers/renderers), lock-free Master-mmap 0640 SHM security metrics (with feature_flags + Cacheline 6), litehttpd-explain (standalone offline .htaccess policy simulator & CI assertion tool), litehttpd-firewalld (privilege-tiered ban/unban/flush + status + metrics CLI + opt-in loopback Prometheus/JSON exporter), litehttpd-audit (real ap_expr validation + SARIF 2.1.0 + explain passthrough), and a versioned ABI handshake (litehttpd_get_abi_info).
- 120 .htaccess directives (Verified against Live Apache 2.4) -- Header (
set/always/append/merge/add/unset/edit/edit*), Redirect (Redirect,RedirectPermanent,RedirectTemp,RedirectMatchwith query-string preservation), RewriteRule/RewriteCond ([QSD],[QSA],[E=verifycaptcha]), SetEnv, Expires, php_value/php_flag, Options (-Indexes,-FollowSymLinks),Require expr/not expr,<RequireNone>/<RequireAll>/<RequireAny>,AuthGroupFile+Require group, hardened AuthType Basic ($apr1$/{SHA}/crypt+ bcrypt cost cap, HMAC-keyed positive cache & confined auth file loading viaHTACCESS_VHROOT/LITEHTTPD_AUTH_ALLOWED_DIRS), DirectoryIndex, FilesMatch, ESI, 5D BotChallenge + ALTCHA v1, RateLimit (action=challenge|ban), LSCache, ModSecurity bridge, and more — backed by our blocking real Apache 2.4 differential suite (COMPATIBILITY_SCOREBOARD.md) - Offline Policy Simulator & CI Gate (
litehttpd-explain) -- Standalone C11 CLI sharing the exactlitehttpd_core_objsobject library withlitehttpd_htaccess.so(zero OLS daemon, zero SHM/network): 10-stage execution trace (dirwalk→response),--format text|json,--allow-override/--allow-override-list,--auth-env/--auth-filecredential redaction, default uid-0 refusal, CI assertions (--expect-status/--expect-header/--expect-location/--expect-uri), andlitehttpd-audit explainpassthrough - Pure-
stdRust Security Core (litehttpd-coreABI v3) -- Statically linked intolitehttpd_htaccess.so(zero external crates, MSRV 1.75.0,catch_unwindFFI isolation) powering unified SHA-256/HMAC/MD5/SHA-1 crypto, Basic Auth/$apr1$/{SHA}, BotChallenge parsers & HTML/JS renderers, ALTCHA v1 PoW/HMAC, the quote-aware ESI streaming state machine, bounded incremental HTTP/1.1 + RFC 9112 chunked dynamic ESI parsing, and the single-passap_exprlexer/AST parser - Zero-Intrusion Security Observability -- 4 KB cacheline-aligned atomic SHM page (
/run/litehttpd/metrics.shm, Master-mmap0640with immediateclose(fd)beforefork(), rolling-upgradefeature_flags+ Cacheline 6),litehttpd-firewalld metrics [--prometheus|--json]CLI (includinglitehttpd_firewalld_active_cidr_bans), and opt-in non-blocking loopback HTTP/metricsexporter (zero IP lists exposed) - Native 5D Bot Defense & Pure-
stdRust ALTCHA v1 --BotChallengeMode on-demand,RateLimit action=challenge|ban, opt-inBotChallengeFailLimit,BotChallengeConnLimit,BruteForceAction challenge|challenge-drop,[E=verifycaptcha],BotChallengePreset,BotChallengeEscalate firewall,BotChallengeDebugHeader, and zero-CDN SHA-256BotChallengeProvider altcha - Rust Ops & Migration CLI --
litehttpd-firewalld(admin-only IPv4/IPv6 CIDR & single-IPban/unban/flush --source|--all --yeswithSO_PEERCREDtiering & non-overlap guards,status [--source <src>] [--json],metrics [--prometheus|--json]) andlitehttpd-audit [--format text|json|sarif] [--strict](read-only 120-directive.htaccessstructural stack, realap_expr, config-bounds & security-advisory auditor +explainsubcommand) - If/ElseIf/Else conditional blocks &
Require [not] exprwith ap_expr engine (&&,||,!,-f,-d,-ipmatch, regex, functions) - RewriteOptions inherit/IgnoreInherit and native/OLS RewriteEngine execution
- IPv4/IPv6 CIDR access control with IPv4-mapped IPv6 unwrapping (
::ffff:),Require ip/Require not ip,Require env,Require group,<RequireNone>, andSatisfy - AllowOverride ∪ AllowOverrideList category and per-directive governance filtering (AuthConfig, FileInfo, Indexes, Limit, Options + 64-token directive allowlist with fail-closed container protection)
- HTACCESS_VHROOT three-level
.htaccessmerging - litehttpd-confconv: Apache
httpd.confto OLS config converter (65+ directives, panel detection, Macro support, SSL extended) - readApacheConf: Embedded Apache config parser in OLS binary (like CyberPanel/LSWS)
One RPM installs everything: patched OLS + litehttpd module + auto-configuration.
# Add repository and install (recommended)
curl -s https://rpms.litehttpd.com/setup.sh | bash
dnf install openlitespeed-litehttpd
# Or download RPM directly from https://rpms.litehttpd.com/
rpm -ivh openlitespeed-litehttpd-1.9.5-1.litehttpd.el9.x86_64.rpm
# Restart OLS
/usr/local/lsws/bin/lswsctrl restartThe RPM %post automatically:
- Enables the litehttpd module in
httpd_config.conf - Enables vhost rewrite (for WordPress permalinks)
- Adds
index.phpto indexFiles
PHP is not included — install your preferred PHP separately (lsphp from LiteSpeed repo, or php-litespeed from Remi).
For stock (unpatched) OLS. Download the .so from rpms.litehttpd.com:
# Download module for your platform (el8/el9/el10/ubuntu22)
curl -LO https://rpms.litehttpd.com/el9/x86_64/RPMS/litehttpd_htaccess-el9-x86_64.so
cp litehttpd_htaccess-el9-x86_64.so /usr/local/lsws/modules/litehttpd_htaccess.so
# Enable module
cat >> /usr/local/lsws/conf/httpd_config.conf <<'EOF'
module litehttpd_htaccess {
ls_enabled 1
}
EOF
# Enable rewrite in vhost (required for WordPress permalinks)
VHCONF=/usr/local/lsws/conf/vhosts/Example/vhconf.conf
sed -i '/^rewrite {/,/^}/s/enable 0/enable 1/' $VHCONF
sed -i 's/indexFiles index.html/indexFiles index.php, index.html/' $VHCONF
# Restart OLS
/usr/local/lsws/bin/lswsctrl restartNote: Thin mode supports all 120 directives including
Require expr/<RequireNone>/AuthGroupFile,AllowOverrideList, built-in PCRE2RewriteRule([QSD],[E=verifycaptcha]), 5D BotChallenge + Rust ALTCHA v1, and module-enforcedOptions -Indexes. Full mode adds OLS-nativeRewriteEngine, per-requestPHPConfig(php_value/php_flag),set_req_header, andreadApacheConf.
LiteHTTPD provides two ways to convert Apache httpd.conf to OLS format, using the same parser (65+ directives, panel detection, Macro support, SSL extended):
Add one line to OLS config -- Apache config is parsed in-process at startup (like CyberPanel/LSWS):
# In /usr/local/lsws/conf/httpd_config.conf:
readApacheConf /etc/httpd/conf/httpd.conf portmap=80:8088,443:8443
OLS starts, parses the Apache config, generates native OLS vhost/listener configs, and loads them automatically. No external tools, no fork/exec.
Standalone tool for manual conversion, change detection, and hot-reload:
# One-time conversion
litehttpd-confconv --input /etc/httpd/conf/httpd.conf \
--output /usr/local/lsws/conf/apacheconf/ \
portmap=80:8088,443:8443
# Check if Apache config changed (for CI/scripts)
litehttpd-confconv --check /etc/httpd/conf/httpd.conf --state /var/run/confconv.state
# Exit: 0=changed, 1=unchanged, 2=error
# Watch mode (auto-reconvert on changes)
litehttpd-confconv --watch /etc/httpd/conf/httpd.conf --interval 60 \
--output /usr/local/lsws/conf/apacheconf/Both use the same parser. readApacheConf is for "set and forget" production use; the CLI is for migration previews, debugging, CI pipelines, and llstack integration.
Three patches extend OpenLiteSpeed 1.9.5 for full functionality (Options -Indexes 403 is enforced directly inside litehttpd_htaccess.so, so the legacy autoindex patch is no longer needed):
| Patch | Description |
|---|---|
0001-lsiapi-phpconfig.patch |
Per-request PHPConfig (php_value/php_flag to lsphp), set_req_header, and versioned ABI handshake (litehttpd_get_abi_info) |
0002-lsiapi-rewrite.patch |
RewriteRule engine LSIAPI extensions (parse/exec/free with RewriteBase override) |
0003-readapacheconf.patch |
Embedded Apache config parser + readApacheConf directive (heap-allocated config, post-parse portmap=) |
Apply to OLS 1.9.5 source before building:
cd openlitespeed-1.9.5/
# Copy confconv parser/writer into OLS source tree (needed by patch 0003)
cp /path/to/apacheconf_parser.{c,h} src/main/
cp /path/to/ols_config_writer.{c,h} src/main/
# Apply patches in order
patch -p1 < 0001-lsiapi-phpconfig.patch
patch -p1 < 0002-lsiapi-rewrite.patch
patch -p1 < 0003-readapacheconf.patchWithout patches, the module still works on stock OLS -- RewriteRule uses the built-in PCRE2 rewrite engine, Options -Indexes is enforced by the module, and php_value/php_flag degrade safely.
- CMake >= 3.14
- GCC or Clang with C11 support
libpcre2-dev/pcre2-develandpkg-configlibcrypt-dev/libxcrypt-devel- Rust toolchain (only if building optional
firewalld/)
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
# Output:
# build/litehttpd_htaccess.so -- the module
# build/litehttpd-confconv -- the config convertercmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
cmake --build build -j$(nproc)The project includes 1,296+ C/C++ tests via CTest, 104+ pure-std Rust unit/mutation-fuzz/UDS integration tests (litehttpd-core, litehttpd-audit, litehttpd-firewalld), and a 6-target Clang libFuzzer suite (-DBUILD_FUZZING=ON) gated in CI (fuzz-smoke):
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j$(nproc)
# Run all C/C++ tests (unit, property, compat, confconv, ESI, SHM, BotChallenge, concurrency, ABI)
ctest --test-dir build --output-on-failure -j$(nproc)
# Run Rust firewalld checks & tests
cargo fmt --manifest-path firewalld/Cargo.toml --check
cargo clippy --manifest-path firewalld/Cargo.toml --all-targets -- -D warnings
cargo test --manifest-path firewalld/Cargo.tomlVerifies all 98 directive types are covered across parser, printer, executor, dirwalker, free, and generator:
bash tests/check_consistency.sh
bash tests/check_patches.shcmake -B build-san -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
cmake --build build-san -j$(nproc)
ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 \
ctest --test-dir build-san --output-on-failure -j$(nproc)Full list of 98 supported directives
Headers: Header set/unset/append/merge/add/edit/edit*, Header always set/unset/append/merge/add/edit/edit*, RequestHeader set/unset
PHP: php_value, php_flag, php_admin_value, php_admin_flag
Access Control: Order, Allow/Deny from, Require all granted/denied, Require ip, Require not ip, Require env, Require valid-user, RequireAny, RequireAll, Satisfy
Authentication: AuthType, AuthName, AuthUserFile
Redirects: Redirect, RedirectMatch, ErrorDocument
Rewrite: RewriteEngine, RewriteBase, RewriteCond, RewriteRule, RewriteOptions (RewriteMap is parsed/recognized only and intentionally disabled in .htaccess for security; configure RewriteMap in native OLS vhost config)
Conditionals: If, ElseIf, Else, IfModule
Content: AddType, AddEncoding, AddCharset, AddDefaultCharset, DefaultType, ForceType, DirectoryIndex, RemoveType, AddHandler¹, SetHandler¹, RemoveHandler¹, Action¹
Caching: ExpiresActive, ExpiresByType, ExpiresDefault
Environment: SetEnv, SetEnvIf, SetEnvIfNoCase, BrowserMatch
Containers: Files, FilesMatch, Limit, LimitExcept
Options: Options
Brute Force: LSBruteForceProtection, LSBruteForceAllowedAttempts, LSBruteForceWindow, LSBruteForceAction, LSBruteForceThrottleDuration, LSBruteForceXForwardedFor, LSBruteForceWhitelist, LSBruteForceProtectPath
¹ Parsed but no-op: OLS uses scriptHandler in vhost config instead of .htaccess handler directives. These directives are recognized and logged but do not change request handling.
| Test | Apache | OLS-Thin | OLS-Full | Stock OLS |
|---|---|---|---|---|
| WordPress Home | ✅ 200 | ✅ 200 | ✅ 200 | ✅ 200 |
| Pretty Permalink | ✅ 200 | ✅ 200 | ✅ 200 | ✅ 200 |
| Security Headers (nosniff, X-Frame) | ✅ | ✅ | ✅ | ❌ |
| wp-config.php blocked | ✅ 403 | ✅ 403 | ✅ 403 | ❌ 200 |
| xmlrpc.php blocked | ✅ 403 | ✅ 403 | ✅ 403 | ❌ 405 |
| .htaccess blocked | ✅ 403 | ✅ 403 | ✅ 403 | ✅ 403 |
| Pass rate | 10/10 | 10/10 | 10/10 | 6/10 |
| Metric | Apache | Stock OLS | OLS-Full (RPM) |
|---|---|---|---|
| Static RPS | 23,909 | 63,140 | 58,891 |
| PHP RPS (wp-login) | 274 | 258 | 292 |
| Permalink RPS | 69 | 1.1 | 1.1 |
| Metric | Apache | Stock OLS | OLS-Full (RPM) |
|---|---|---|---|
| Total Memory | 818 MB | 654 MB | 689 MB |
| Server RSS | 618 MB | 320 MB | 449 MB |
| Process Count | 18 | 14 | 17 |
- OLS-Full (RPM): One RPM install — patched OLS + bundled module + auto-configured
- Stock OLS: Official OLS without .htaccess module
Key findings:
- OLS-Full achieves 100% Apache .htaccess compatibility (10/10 vs Stock OLS 6/10)
- Static performance 2.5x faster than Apache with 20% less memory
- PHP performance slightly better than Apache (292 vs 274 rps)
- Stock OLS exposes wp-config.php (200) — security risk without .htaccess
- Permalink rewrite is slow on all OLS engines (OLS architecture limitation)
Tested with: Wordfence, All In One WP Security, W3 Total Cache, WP Super Cache, Yoast SEO, Redirection, WPS Hide Login, Disable XML-RPC, iThemes Security, HTTP Headers
| Test | Apache | OLS-Full (RPM) |
|---|---|---|
| Home (10 plugins active) | ✅ 200 | ✅ 200 |
| Pretty Permalink | ✅ 200 | ✅ 200 |
| Yoast Sitemap | ✅ 200 | ✅ 200 |
| xmlrpc blocked | ✅ 403 | ✅ 403 |
| wp-config protected | ✅ 403 | ✅ 403 |
| Security Headers | ✅ nosniff + xframe | ✅ nosniff + xframe |
| Cache Headers on JS | ✅ 2 headers | ✅ 2 headers |
| REST API | ✅ 200 | ✅ 200 |
| RSS Feed | ✅ 200 | ✅ 200 |
| Result | 9/9 match | 9/9 match |
OLS-Full produces identical results to Apache on all .htaccess-dependent plugin tests.
Previous benchmark (5-engine, 19 WP plugins): tests/e2e/vps-5engine/benchmark-results.md
LiteHTTPD uses lsphp (LSAPI protocol) for PHP processing. The default OLS configuration starts a single lsphp process and forks on demand, which causes slow cold starts under load. To match Apache PHP-FPM performance, configure lsphp worker pool size:
# In httpd_config.conf extprocessor section:
extProcessor lsphp {
...
env PHP_LSAPI_CHILDREN=10
env PHP_LSAPI_MAX_IDLE=300
...
}
| Config | PHP RPS (wp-login.php, c=5) | Behavior |
|---|---|---|
Default (CHILDREN=1) |
~5 rps | Fork on demand, cold start ~1s per request |
CHILDREN=10 |
~15-20 rps | Pre-forked pool, no cold start |
| Apache PHP-FPM (pm=dynamic) | ~16 rps | Pre-forked pool (reference) |
Note: Stock OLS and LSWS may show very high PHP RPS (20K-35K) in benchmarks due to built-in page caching (LSCache). This is the cache module returning stored responses, not actual PHP execution. LiteHTTPD does not include a page cache module — use LiteSpeed Cache WordPress plugin with OLS native cache module for equivalent behavior.
OLS defaults to rewrite { enable 0 } in vhost config. The .htaccess RewriteRule is parsed by litehttpd but OLS's rewrite engine won't execute it unless vhost-level rewrite is enabled.
Fix: Edit your vhost config (e.g., /usr/local/lsws/conf/vhosts/Example/vhconf.conf):
rewrite {
enable 1 # <-- change from 0 to 1
logLevel 0
}
Then restart OLS: /usr/local/lsws/bin/lswsctrl restart
OLS needs a scriptHandler mapping PHP to lsphp. Check that your httpd_config.conf has:
scriptHandler {
add lsapi:lsphp php # name must match extProcessor name
}
And the extProcessor lsphp path points to the correct lsphp binary (e.g., $SERVER_ROOT/lsphp83/bin/lsphp).
OLS default indexFiles only includes index.html. Add index.php:
index {
indexFiles index.php, index.html
}
LiteHTTPD is a sub-project of Web.Casa, an AI-native open source server control panel.
Related project: LLStack -- a server management platform built on LiteHTTPD.
This project is licensed under the GNU General Public License v3.0 -- see LICENSE for details.
OpenLiteSpeed is developed by LiteSpeed Technologies and is also GPLv3 licensed.