From aaPanel (BT Panel)
Overview
Section titled “Overview”aaPanel (宝塔面板) installs OLS via its App Store. It uses standard OLS paths (/usr/local/lsws/) but manages config files through the panel UI. Stock aaPanel OLS has no .htaccess support beyond basic RewriteFile processing — which is why many aaPanel + OLS users find that .htaccess rules don’t work.
LiteHTTPD adds full .htaccess support (80 directives) to your aaPanel OLS setup.
Installation
Section titled “Installation”# Add LiteHTTPD repo and installcurl -s https://rpms.litehttpd.com/setup.sh | bashdnf install openlitespeed-litehttpd
# Restartsystemctl restart lswsFor Thin mode (no binary replacement), see From Stock OLS.
aaPanel-Specific Considerations
Section titled “aaPanel-Specific Considerations”Do Not Upgrade OLS via App Store
Section titled “Do Not Upgrade OLS via App Store”The aaPanel App Store “Upgrade” button re-installs the stock OLS binary, overwriting the patched version. After any aaPanel-triggered OLS upgrade:
dnf reinstall openlitespeed-litehttpdsystemctl restart lswsvhost Config Regeneration
Section titled “vhost Config Regeneration”aaPanel regenerates vhost .conf files when you change site settings (PHP version, SSL, domain aliases). Custom directives added to vhost.conf may be lost.
Use .htaccess files for per-site rules — aaPanel does not modify files in your document root.
Verify Module Config After Panel Operations
Section titled “Verify Module Config After Panel Operations”aaPanel modifies httpd_config.conf on server-level changes. The LiteHTTPD module block is usually preserved, but verify after major panel operations:
grep -c 'litehttpd_htaccess' /usr/local/lsws/conf/httpd_config.conf# Should output: 1Disable OLS autoLoadHtaccess
Section titled “Disable OLS autoLoadHtaccess”If your aaPanel vhost configs have autoLoadHtaccess 1, disable it to avoid double-processing with LiteHTTPD:
grep -r 'autoLoadHtaccess' /usr/local/lsws/conf/vhosts/# If any show 1, change to 0:sed -i 's/autoLoadHtaccess.*1/autoLoadHtaccess 0/' /usr/local/lsws/conf/vhosts/*/vhost.confPHP-FPM vs LSPHP
Section titled “PHP-FPM vs LSPHP”Some aaPanel versions install PHP-FPM instead of LSPHP for OLS. LiteHTTPD’s php_value/php_flag directives (Full mode) require LSPHP (LSAPI protocol).
Check which PHP you’re running:
# If this returns a path, you have LSPHPls /usr/local/lsws/lsphp*/bin/lsphp 2>/dev/null
# Check your vhost config for the handler typegrep -A5 'extProcessor' /usr/local/lsws/conf/vhosts/*/vhost.confIf you see PHP-FPM instead of LSPHP:
dnf install lsphp83 lsphp83-common lsphp83-mysqlndThen update the external app path in the vhost config to /usr/local/lsws/lsphp83/bin/lsphp, or change it through the OLS WebAdmin console (port 7080).
Enable .htaccess for Each Site
Section titled “Enable .htaccess for Each Site”Stock aaPanel OLS may not have .htaccess processing enabled for your sites. After installing LiteHTTPD, the module automatically processes .htaccess files — no additional OLS-level configuration is needed. The module hooks into the request pipeline directly.
However, for WordPress permalink support, ensure rewrite is enabled in each vhost:
# In /usr/local/lsws/conf/vhosts/<name>/vhost.confrewrite { enable 1}Behavioral Changes
Section titled “Behavioral Changes”After installing LiteHTTPD, be aware of these changes from stock OLS behavior:
-
.htaccessfiles now work — This is the whole point, but review your.htaccessfiles. Directives that stock OLS previously ignored (likeHeader set,Require all denied,FilesMatch) are now active. -
.ht*files are blocked — Requests to.htaccess,.htpasswdreturn 403 (Apache-compatible security). Stock OLS may serve or 404 these files. -
Path traversal blocked — Encoded
../sequences return 403.
Verification
Section titled “Verification”# Test .htaccess processingecho 'Header set X-LiteHTTPD "active"' > /www/wwwroot/example.com/.htaccesscurl -sI https://example.com/ | grep X-LiteHTTPD# Expected: X-LiteHTTPD: active
# Clean uprm /www/wwwroot/example.com/.htaccess