CyberPanel

CyberPanel OpenLiteSpeed Module – Complete Usage Guide

CyberPanel OpenLiteSpeed Module
On this page

Version: 2.2.0 | Last Updated: December 28, 2025 | Status: Production Ready

Introduction

The CyberPanel OpenLiteSpeed Module brings Apache .htaccess compatibility to OpenLiteSpeed servers. Use familiar Apache directives without switching web servers.

Quick Start

  1. Module is pre-installed on CyberPanel servers
  2. Create .htaccess in your website’s public_html directory
  3. Add directives from this guide
  4. Test using curl or a browser

1. Header Directives

HTTP headers control browser behavior, caching, security, and more.

Supported Operations

Security Headers Example

# Prevent clickjacking
Header set X-Frame-Options "SAMEORIGIN"

# Prevent MIME sniffing
Header set X-Content-Type-Options "nosniff"

# Enable XSS filter
Header set X-XSS-Protection "1; mode=block"

# Control referrer
Header set Referrer-Policy "strict-origin-when-cross-origin"

# Hide server info
Header unset Server
Header unset X-Powered-By

Cache Control Headers

# Cache for 1 year (static assets)
Header set Cache-Control "max-age=31536000, public, immutable"

# No caching (dynamic content)
Header set Cache-Control "no-cache, no-store, must-revalidate"

CORS Headers

# Allow cross-origin requests
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"

2. Request Header Directives

Modify headers before they reach your PHP application.

Behind Proxy Configuration

RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-SSL "on"
RequestHeader set X-Real-IP "%{REMOTE_ADDR}e"

3. Environment Variables

Example Usage

# Application settings
SetEnv APPLICATION_ENV production
SetEnv DEBUG_MODE off

# Browser detection
SetEnvIfNoCase User-Agent "mobile|android|iphone" IS_MOBILE=1
BrowserMatch "Chrome" IS_CHROME=1

4. Access Control

Restrict access based on IP addresses.

Block All Except Specific IPs

Order deny,allow
Deny from all
Allow from 203.0.113.50
Allow from 192.168.1.0/24

Allow All Except Specific IPs

Order allow,deny
Allow from all
Deny from 198.51.100.50

5. Redirect Directives

Examples

# Simple redirect
Redirect 301 /old-page.html /new-page.html

# Pattern-based
RedirectMatch 301 ^/blog/(.*)$ /news/$1

6. Error Documents

ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
ErrorDocument 403 "Access Denied"

7. FilesMatch Directives

Apply directives to files matching a pattern.

Cache Static Assets

<FilesMatch "\.(jpg|jpeg|png|gif|webp|svg|ico)$">
    Header set Cache-Control "max-age=31536000, public, immutable"
</FilesMatch>

<FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=604800, public"
</FilesMatch>

8. Expires Directives

ExpiresActive On
ExpiresByType image/jpeg A31557600
ExpiresByType text/css A2592000
ExpiresByType application/javascript A2592000

9. PHP Directives

WordPress Configuration

php_value memory_limit 256M
php_value max_execution_time 300
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_flag display_errors off
php_flag log_errors on

WooCommerce Configuration

php_value memory_limit 512M
php_value max_execution_time 600
php_value max_input_vars 10000

10. Brute Force Protection

Built-in WordPress login protection against password-guessing attacks.

Quick Enable

BruteForceProtection On

Directives Reference

Progressive Throttle (v2.2.0)

When using BruteForceAction throttle:

Recommended Configuration

BruteForceProtection On
BruteForceAllowedAttempts 5
BruteForceWindow 300
BruteForceAction throttle
BruteForceXForwardedFor On

With IP Whitelist

BruteForceProtection On
BruteForceAllowedAttempts 3
BruteForceWindow 900
BruteForceAction block
BruteForceWhitelist 203.0.113.50, 192.168.1.0/24

Complete WordPress .htaccess

# Security Headers
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
Header unset X-Powered-By

# Brute Force Protection
BruteForceProtection On
BruteForceAllowedAttempts 5
BruteForceWindow 300
BruteForceAction throttle

# Cache Static Assets
<FilesMatch "\.(jpg|jpeg|png|gif|webp|svg|ico)$">
    Header set Cache-Control "max-age=31536000, public, immutable"
</FilesMatch>

<FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=2592000, public"
</FilesMatch>

# PHP Configuration
php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_flag display_errors off

# WordPress Rewrite Rules
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Troubleshooting

Directives Not Working

# Check module installed
ls -la /usr/local/lsws/modules/cyberpanel_ols.so

# Restart OpenLiteSpeed
/usr/local/lsws/bin/lswsctrl restart

# Check logs
tail -50 /usr/local/lsws/logs/error.log

.htaccess Permissions

chmod 644 /home/yourdomain.com/public_html/.htaccess
chown nobody:nogroup /home/yourdomain.com/public_html/.htaccess

Brute Force Not Triggering

# Check shared memory
ls -la /dev/shm/ols/

# Create if missing
mkdir -p /dev/shm/ols && chmod 755 /dev/shm/ols

# Restart
/usr/local/lsws/bin/lswsctrl restart

Quick Reference

Headers

Header set Name "Value"
Header unset Name

Access Control

Order deny,allow
Deny from all
Allow from 192.168.1.0/24

Redirects

Redirect 301 /old /new
RedirectMatch 301 ^/blog/(.*)$ /news/$1

PHP

php_value memory_limit 256M
php_flag display_errors off

Brute Force

BruteForceProtection On
BruteForceAllowedAttempts 5
BruteForceAction throttle

Support

Module Version: 2.2.0 | Last Updated: December 28, 2025

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat on WhatsApp