Skip to content

Web server modes ​

This page explains the web server modes MoorCP supports and how to switch modes on a running server without recreating websites. It is written for admins and technicians.

Website data is stored in a neutral form in the panel. Each mode renders its own configuration from that data, so websites do not need to be recreated when the mode changes.

Supported modes ​

ModeServices.htaccessHTTPS served by
nginx-proxy (default)Nginx in front of ApacheFull (Apache)Nginx
nginxNginx + PHP-FPM per accountConverted to Nginx rulesNginx
apacheApache event MPM + PHP-FPM per accountFullApache (needs mod_ssl)
openlitespeedOpenLiteSpeed + lsphp (LSAPI) per accountRewrites read by OpenLiteSpeed, some other rules convertedOpenLiteSpeed

LiteSpeed Enterprise is not available as a mode yet. The pre-flight reports it as a blocker.

Choosing a mode ​

NeedChoice
Full compatibility with .htaccess and applications migrated from cPanelnginx-proxy
Lightest option, modern websites (WordPress, Laravel)nginx
Apache only, no Nginxapache
PHP over LSAPI and .htaccess rewritesopenlitespeed
CloudLinux PHP Selector (mod_lsapi)apache or nginx-proxy

The initial mode is chosen when adding the server (Default web server). See Servers › Adding a server.

Switching the web server ​

Open Servers › (server) › Settings › Web server, or Actions › Switch web server in the server's details.

The page shows the current web server, the Target web server choice, Selection preview with the number of affected accounts and websites, Preflight status, and Rollback summary.

1. Run the pre-flight ​

  1. Choose the Target web server.
  2. Click Run preflight.

The pre-flight changes nothing. Its results:

TypeExamples
BlockersThe target mode's binary is not installed, mod_ssl is missing (apache mode), lsphp for a version used by websites is not installed, the target mode is the same as the current mode.
Warnings.htaccess rules that will not apply on the target, per site. PHP-FPM extensions that do not exist in lsphp.
Service planServices to be stopped and started.

If there are blockers, the panel shows Cannot switch. Resolve the blockers first, then run the pre-flight again.

Preparing OpenLiteSpeed

If the server does not have OpenLiteSpeed yet, click Install OpenLiteSpeed + lsphp. The panel installs OpenLiteSpeed and lsphp for every installed PHP version. OpenLiteSpeed stays off until that mode is chosen. The process can take a few minutes.

2. Review the plan and switch ​

  1. Click Review switch plan.
  2. Read the services to be stopped and started, and the .htaccess rules that will not apply.
  3. Type the server's hostname to confirm.
  4. Click Switch now.

During the process, sites can be briefly unavailable while services restart. The switch usually finishes within seconds.

WARNING

The switch affects every website on the server. Do it in quiet hours and read all .htaccess warnings before switching.

What the agent does ​

  1. Checks a sample of sites (at most 25) over HTTP and HTTPS before the switch.
  2. Backs up /etc/nginx and /etc/httpd. The last ten backups are kept.
  3. Stops services of the old mode that the target mode does not use.
  4. Prepares the target mode's base configuration and read permissions for the web server user.
  5. Renders the hostname vhosts (webmail, phpMyAdmin) and the vhosts of all websites.
  6. Validates the configuration, then starts the target mode's services.
  7. Checks the site sample again.

Automatic rollback ​

If a step fails, or a site gets worse, the agent automatically:

  • stops the target mode's services;
  • restores /etc/nginx and /etc/httpd from the backup;
  • starts the original mode's services again.

A site counts as worse when it answered before and then fails to connect or returns a 5xx error, or goes from 2xx/3xx to 4xx.

The switch result is shown in the switch window:

ResultMeaning
Now runningSuccess. The mode in the panel changes too.
Rolled back toA site got worse. The site table shows HTTP and HTTPS status before and after, marked worse.
Switch failedA step failed. The server stays on the old mode.

The switch job is not retried automatically. The mode in the panel only changes when the switch succeeds.

.htaccess conversion ​

nginx mode ​

Nginx does not read .htaccess. The agent reads .htaccess in the document root and subdirectories, then turns known patterns into Nginx rules.

Apache patternNginx result
WordPress, Laravel front controller (!-f, !-d to index.php)try_files $uri $uri/ /index.php?$query_string
Redirect 301 /old /newRedirect with the rest of the path and query passed on
RedirectMatch, RewriteRule ... [R=301], internal rewrites without conditionslocation ~ / rewrite
Force HTTPS, canonical domainif ($scheme) / if ($host)
Deny from all / Require all denied in a subdirectorydeny all for that directory
AuthType Basic + AuthUserFileauth_basic
ErrorDocument 404 /x.htmlerror_page
<Files> / <FilesMatch> that deny or allow fileslocation with deny / allow
Options +Indexes / Options -Indexes (directory listing)autoindex on / autoindex off
Other Options, standard DirectoryIndex, Header, Expires*Ignored, not needed

Anything not converted is reported as a warning, for example php_value, SetEnvIf, non-standard DirectoryIndex, and rewrites with other conditions.

Nginx locations do not inherit from each other, so the converter writes the access rules that apply into every folder's location, the way Apache does: a folder inherits password protection, deny all, and directory listing from the nearest parent folder that sets them, unless it sets them itself. A folder with its own .htaccess inside a password-protected directory therefore still asks for the password.

TIP

Replace php_value in .htaccess with the website's PHP settings in the client panel. See PHP in the client panel.

openlitespeed mode ​

OpenLiteSpeed reads mod_rewrite rules itself. What gets converted to the vhost configuration: directory denials, AuthType Basic, Redirect / RedirectMatch, ErrorDocument, <Files> / <FilesMatch> blocks that deny or allow files, and Options +Indexes / -Indexes. The rest is reported in the pre-flight.

Directory denials and listing settings are written into every subfolder's context, with the same inheritance as in nginx mode. The file list is built by OpenLiteSpeed's autoindex script, run by the account's own lsphp as the account user. A folder without an index page and without listing returns 404 in OpenLiteSpeed, while Apache and Nginx return 403.

Clients turn directory listing on or off per folder in the client panel, see Websites in the client panel.

After .htaccess changes ​

In nginx mode, .htaccess changes made after the switch only take effect when the vhost is applied again: save the website, or click Re-apply virtual hosts on the Web server page.

In openlitespeed mode this happens on its own. OpenLiteSpeed keeps rewrite rules in memory, so without help a changed .htaccess, for example new WordPress permalinks, would only apply after a restart. The agent watches .htaccess files under /home (file names only, it does not read their contents). When one is written, renamed, or deleted, the agent renders the configuration again and reloads OpenLiteSpeed after 3 quiet seconds, at most once every 15 seconds. New rules usually apply within a few seconds.

Notes per mode ​

apache ​

  • Apache serves HTTP and HTTPS itself, with TLS 1.2/1.3.
  • Install mod_ssl before switching to this mode. The pre-flight blocks the switch if it is missing.
  • Webmail and phpMyAdmin are served by the hostname vhost. Unknown domain names get 404/403, not another account's site.

.htaccess limits in Apache ​

These limits apply wherever Apache reads .htaccess, so in both apache and nginx-proxy modes:

  • .htaccess may use rewrites, authentication, headers, and some Options, but not ExecCGI, Includes, or FollowSymLinks. Options +FollowSymLinks in .htaccess returns error 500. Use Options +SymLinksIfOwnerMatch instead.
  • Handler directives such as SetHandler, AddHandler, and Action are ignored, not an error. .htaccess files migrated from cPanel often contain AddHandler lines for a PHP version, and these sites keep working. Choose the PHP version in the website's settings instead.
  • PHP settings passed through environment variables (PHP_VALUE, PHP_ADMIN_VALUE) are removed before the request reaches PHP-FPM.
  • Symlinks are followed only when the link and its target have the same owner. This also applies to folders between the home directory and the document root.

openlitespeed ​

  • The OpenLiteSpeed admin console (port 7080) is turned off and the configuration is fully managed by MoorCP.
  • Each account has its own lsphp process run by systemd, so the account's CPU/RAM limits still apply.
  • The number of PHP processes follows the package's entry process limit. Each OpenLiteSpeed worker opens its own lsphp connections, so the account's lsphp may run slightly more processes than the package limit, for example 8 processes for a limit of 5 with 4 workers. This prevents sites from hanging when several requests arrive at once. Idle lsphp processes exit after 30 seconds by default; see OpenLiteSpeed settings.
  • Every website is mapped on the HTTPS listener (port 443), also websites that do not have a certificate yet. Those get the listener's default self-signed certificate, as on cPanel: browsers show a warning, and Cloudflare in Full mode accepts it. A WordPress redirect to https:// or a freshly migrated site therefore no longer ends in 404. Unknown domain names still get 404, not another account's site.
  • After each reload the agent reads error.log and rolls the change back when OpenLiteSpeed reports configuration errors. Errors that belong to a single visitor request (for example [REWRITE] Proxy target is not defined from one account's .htaccess) are not counted, so one broken .htaccess no longer makes every website change and SSL issue on the server fail.
  • lsphp extensions equivalent to the PHP-FPM extensions are installed automatically during the switch when they are available in the repository.
  • Webmail and phpMyAdmin are served through an internal Nginx relay.
  • Static files are compressed with gzip and brotli. PHP pages are compressed with gzip only. For brotli on PHP pages, see PHP versions › Brotli for lsphp.

OpenLiteSpeed settings ​

On a server in openlitespeed mode, the Web server settings page has an OpenLiteSpeed settings card. The agent stores the values and renders them into httpd_config.conf on every reload.

FieldDefaultNotes
Worker processesAutomatic (CPU count, max 4)1 to 16. The card shows the effective number and how many lsphp processes a package gets. Changing it adjusts the lsphp services of every account.
Keep-alive timeout (seconds)50 to 60. 0 turns keep-alive off.
Max connections10000100 to 100000. Concurrent HTTP connections.
Max SSL connections0Up to 100000. Concurrent HTTPS connections. 0 follows Max connections. Suggested 10000.
Connection timeout (seconds)30010 to 3600. Idle connections are closed after this. Suggested 60, because 300 holds connection slots too long.
Max keep-alive requests100001 to 1000000. Requests served over one keep-alive connection.
Smart keep-aliveOffKeep-alive only for static files (JS, CSS, images). PHP pages close the connection so slots free up faster. Suggested on.
Gzip compression (pages and static files), Gzip levelOn, 6Level 1 to 9.
Brotli compression (static files), Brotli levelOn, 6Level 1 to 11.
HTTP/3 (QUIC) on HTTPSOffNeeds UDP port 443 open in the server firewall. See Security › Firewall ports.
lsphp per account › Idle time before a PHP process exits (seconds)3010 to 3600 (LSAPI_MAX_IDLE) for the lsphp of every account. Shorter frees RAM sooner; longer avoids the start-up cost on the next visit. Suggested 60.
lsphp per account › LSAPI_AVOID_FORK (MB)20016 to 8192. When the lsphp parent uses more RAM than this, it stops forking new children and reuses existing ones.

Use suggested values fills in values for a busy shared hosting server: max connections and max SSL connections 10000, connection timeout 60, keep-alive requests 10000, keep-alive timeout 5, smart keep-alive on, gzip and brotli on, lsphp idle time 60, and LSAPI_AVOID_FORK 200. Worker processes and HTTP/3 are not changed. The button only shows when the current values differ from the suggestions.

Click Save and apply. Values out of range are refused. On a server with an older agent, the connection, smart keep-alive, and lsphp fields are not shown until the agent is upgraded.

Limits per account come from the package

The number of PHP processes, RAM, and process count per account are not set here. They come from the account's package (entry processes, memory, and NPROC) and are enforced by the account's cgroup slice. For about 200 accounts on 32 GB of RAM, suggested package values are entry processes 10, memory 1024 MB, and NPROC 60. See Packages.

nginx and nginx-proxy ​

Nginx refuses the TLS handshake for unknown domain names, so other accounts' sites do not answer. Symlinks are only followed when the link and its target have the same owner, including folders between the home directory and the document root.

IPv6 ​

Every mode serves websites over IPv6 as soon as the server has an IPv6 address. See Server settings › General.

ModeListener
nginx, nginx-proxylisten 80 and listen [::]:80, the same for 443.
apache*:80 and *:443, which cover IPv4 and IPv6.
openlitespeed[ANY]:80 and [ANY]:443 (IPv4 and IPv6) when the kernel has IPv6 and net.ipv6.bindv6only is 0, the EL9 default. Otherwise *:80 and *:443, IPv4 only.

When the server's IPv6 address is set or changed, the panel reloads the web server. When the OpenLiteSpeed listener changes, the agent checks the listening sockets after the reload. If they do not match the configuration, it stops OpenLiteSpeed fully and starts it again, so IPv4 connections do not hang on an old socket.

See also ​

MoorCP Shared, a shared hosting panel for server fleets.