Skip to content
zefıly

Sites

Custom OpenLiteSpeed configuration

Add your own OpenLiteSpeed rules to a site — rewrites, headers, browser caching and address limits — and see what is refused and why.

On servers running OpenLiteSpeed, the site's Custom OpenLiteSpeed pane adds your own rules to the site's virtual host. It is not a full virtual host: Zefily writes the virtual host and keeps your rules inside it, each one a context block for one path. Rules in a .htaccess file in the web root are read by OpenLiteSpeed too. On nginx servers, see Custom nginx configuration.

Many common needs are already buttons in the site's Access and Rules panes: canonical host, password protection, allowed addresses, maintenance mode, redirects, response headers, CORS, error pages, restricted paths and blocked addresses. Use those first: Zefily keeps them when it changes the site.

What Zefily writes

Zefily writes the site's whole virtual host: the web root, the index files, the site's logs, its own PHP handler (its PHP-FPM pool, or its LiteSpeed PHP), the HTTPS certificate, the listeners, the page cache and the Access and Rules settings. It also writes the contexts every site has: the certificate check path, hidden dotfiles and backup files.

Your context blocks go after those, between lines Zefily marks as its own, so a later change to the site keeps them. A context / of your own is refused, because Zefily writes it.

Add rules

  1. Open the site and choose Custom OpenLiteSpeed.
  2. Write your rules in the editor, or start from an example: Redirect, Headers, Caching, Access, Security headers.
  3. Click Apply and approve with your passkey.

Zefily checks your text first. If one line is not allowed, the whole text is refused and the message names the line; accepted text is saved in its canonical form (indentation is normalized). Then OpenLiteSpeed checks the whole virtual host (lshttpd -t) before it restarts. If a check or the restart fails, the previous configuration is put back and the error is shown in the pane and in Activity. Leave the editor empty and apply to remove your rules.

Examples

These are the examples the checks accept as written.

A redirect for an old path (a 301 from /old-blog/… to /blog/…):

context exp:^/old-blog/ {
  rewrite {
    enable 1
    rules <<<END_rules
RewriteRule ^/old-blog/(.*)$ /blog/$1 [R=301,L]
END_rules
  }
}

Extra headers for images:

context exp:\.(jpg|png|webp)$ {
  extraHeaders <<<END_extraHeaders
set Cache-Control "public, max-age=86400"
END_extraHeaders
}

Browser caching of a folder:

context /assets/ {
  enableExpires 1
  expiresByType text/css: A604800
  expiresByType application/javascript: A604800
}

One address only for a folder:

context /admin/ {
  accessControl {
    allow 203.0.113.7
    deny *
  }
}

A security header on every page (a pattern that matches every path):

context exp:.* {
  extraHeaders <<<END_extraHeaders
set X-Frame-Options SAMEORIGIN
END_extraHeaders
}

Paths

  • A plain path such as context /downloads/ names a folder in the site's web root. For a URL that is not a folder (a redirect, or a prefix that several folders share), write a pattern: context exp:^/old-blog/.
  • Each path can appear once. At most 20 context blocks and 16 KB of text per site.

What is allowed

Inside a context block, these are accepted:

  • rewrite with enable and rules: RewriteRule, RewriteCond and RewriteBase lines (30 lines at most). A proxy flag ([P] or [proxy]) is refused.
  • extraHeaders with set and unset lines (30 lines at most). Strict-Transport-Security (HSTS, set from the site's HTTPS settings) and Set-Cookie cannot be set or unset here: they are refused.
  • enableExpires, expiresDefault and expiresByType, for browser caching.
  • accessControl with allow and deny, for IP addresses, networks in CIDR form and *.
  • allowBrowse (directory listing on or off) and addDefaultCharset.

What is refused

Directive Why it is refused Instead
include Reads other files Put the rules in this pane, or in the site's own .htaccess file
extProcessor, scriptHandler Define the PHP or proxy handler, which Zefily sets The site's PHP version is set on its PHP pane
docRoot, vhRoot, location Point at files outside the site's web root, which Zefily sets Your files go in the site's web root, which Zefily sets
user, group, chrootPath, enableChroot The site runs as its own Linux user Set by Zefily
php_admin_value, phpIniOverride Set PHP limits The site's PHP pane (see PHP settings)
module Loads or configures a server module (the cache and the WAF are set by Zefily) The caching and firewall settings in Access, caching and protection
vhssl Sets the certificate The site's General pane, HTTPS and certificate
errorlog, accesslog Write logs outside the site's logs The site's Logs pane
index, type, handler, appType, extAppId Set how files are served Set by Zefily
context / Zefily writes the site's front controller Use a path under it, such as context /downloads/
Proxy contexts (type proxy) Reach other services Reverse proxy and WebSockets need nginx
realm and required (login areas) Need a password file on the server Access → Password-protected folders (per folder) or Password protection (whole site)
Anything else Not in the allowed list Write to support with the rule you need

Limits this pane does not have

  • Reverse proxy and WebSockets are not available on OpenLiteSpeed through this pane. An app that needs WebSockets (such as Laravel Reverb) needs an nginx server.
  • Compression (gzip and Brotli) is set by Zefily for every site.
  • Upload size comes from the site's PHP limits (upload_max_filesize and post_max_size), set on the site's PHP pane.
  • Request rate limits are nginx only (Rules → Request rate limit), and country rules are not available on OpenLiteSpeed.
  • Password-protected folders need a folder that exists under the web root: OpenLiteSpeed refuses a folder it cannot find, and the previous configuration then stays in place.

History and restore

Saving, History and Restore work as on nginx, and need your passkey approval: a version that OpenLiteSpeed refuses never replaces the running configuration, and a save whose approval came too late is never applied. The server's agent must be up to date (its Updates tab).

Updated November 26, 2026 View as Markdown llms.txt

Still stuck?

Open a ticket from your panel or write to us; we answer within a day.

Contact →

Runs the stacks you already use

Black Friday & Cyber Monday

Before you go: lifetime plans are on sale

Pay once for a lifetime plan, or get 30% off the first year of any yearly plan.

Only 100 lifetime plans per plan. When they are gone, they are gone.

See the campaign

Amazing November

See the campaign →