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
| Mode | Services | .htaccess | HTTPS served by |
|---|---|---|---|
nginx-proxy (default) | Nginx in front of Apache | Full (Apache) | Nginx |
nginx | Nginx + PHP-FPM per account | Converted to Nginx rules | Nginx |
apache | Apache event MPM + PHP-FPM per account | Full | Apache (needs mod_ssl) |
openlitespeed | OpenLiteSpeed + lsphp (LSAPI) per account | Rewrites read by OpenLiteSpeed, some other rules converted | OpenLiteSpeed |
LiteSpeed Enterprise is not available as a mode yet. The pre-flight reports it as a blocker.
Choosing a mode
| Need | Choice |
|---|---|
Full compatibility with .htaccess and applications migrated from cPanel | nginx-proxy |
| Lightest option, modern websites (WordPress, Laravel) | nginx |
| Apache only, no Nginx | apache |
PHP over LSAPI and .htaccess rewrites | openlitespeed |
| 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
- Choose the Target web server.
- Click Run preflight.
The pre-flight changes nothing. Its results:
| Type | Examples |
|---|---|
| Blockers | The 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 plan | Services 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
- Click Review switch plan.
- Read the services to be stopped and started, and the
.htaccessrules that will not apply. - Type the server's hostname to confirm.
- 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
- Checks a sample of sites (at most 25) over HTTP and HTTPS before the switch.
- Backs up
/etc/nginxand/etc/httpd. The last ten backups are kept. - Stops services of the old mode that the target mode does not use.
- Prepares the target mode's base configuration and read permissions for the web server user.
- Renders the hostname vhosts (webmail, phpMyAdmin) and the vhosts of all websites.
- Validates the configuration, then starts the target mode's services.
- 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/nginxand/etc/httpdfrom 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:
| Result | Meaning |
|---|---|
| Now running | Success. The mode in the panel changes too. |
| Rolled back to | A site got worse. The site table shows HTTP and HTTPS status before and after, marked worse. |
| Switch failed | A 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 pattern | Nginx result |
|---|---|
WordPress, Laravel front controller (!-f, !-d to index.php) | try_files $uri $uri/ /index.php?$query_string |
Redirect 301 /old /new | Redirect with the rest of the path and query passed on |
RedirectMatch, RewriteRule ... [R=301], internal rewrites without conditions | location ~ / rewrite |
| Force HTTPS, canonical domain | if ($scheme) / if ($host) |
Deny from all / Require all denied in a subdirectory | deny all for that directory |
AuthType Basic + AuthUserFile | auth_basic |
ErrorDocument 404 /x.html | error_page |
<Files> / <FilesMatch> that deny or allow files | location 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_sslbefore 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:
.htaccessmay use rewrites, authentication, headers, and someOptions, but notExecCGI,Includes, orFollowSymLinks.Options +FollowSymLinksin.htaccessreturns error 500. UseOptions +SymLinksIfOwnerMatchinstead.- Handler directives such as
SetHandler,AddHandler, andActionare ignored, not an error..htaccessfiles migrated from cPanel often containAddHandlerlines 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.logand rolls the change back when OpenLiteSpeed reports configuration errors. Errors that belong to a single visitor request (for example[REWRITE] Proxy target is not definedfrom one account's.htaccess) are not counted, so one broken.htaccessno 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.
| Field | Default | Notes |
|---|---|---|
| Worker processes | Automatic (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) | 5 | 0 to 60. 0 turns keep-alive off. |
| Max connections | 10000 | 100 to 100000. Concurrent HTTP connections. |
| Max SSL connections | 0 | Up to 100000. Concurrent HTTPS connections. 0 follows Max connections. Suggested 10000. |
| Connection timeout (seconds) | 300 | 10 to 3600. Idle connections are closed after this. Suggested 60, because 300 holds connection slots too long. |
| Max keep-alive requests | 10000 | 1 to 1000000. Requests served over one keep-alive connection. |
| Smart keep-alive | Off | Keep-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 level | On, 6 | Level 1 to 9. |
| Brotli compression (static files), Brotli level | On, 6 | Level 1 to 11. |
| HTTP/3 (QUIC) on HTTPS | Off | Needs UDP port 443 open in the server firewall. See Security › Firewall ports. |
| lsphp per account › Idle time before a PHP process exits (seconds) | 30 | 10 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) | 200 | 16 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.
| Mode | Listener |
|---|---|
nginx, nginx-proxy | listen 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.
