UnderHost
Knowledgebase Docs

Nginx vs Apache in aaPanel: how to switch

Understand when to use Nginx, Apache, or OpenLiteSpeed in aaPanel. How to install and switch web servers,

On this page

aaPanel lets you install multiple web servers and choose which one handles each site. This flexibility is one of aaPanel's advantages over panels that lock you into a single stack. The right choice depends on your applications and priorities.

Nginx vs Apache vs OpenLiteSpeed

FeatureNginxApacheOpenLiteSpeed
PerformanceExcellent (async, low memory)Good (process/thread based)Excellent (event-driven)
.htaccess support❌ Not supported✅ Full support✅ Compatible
WordPress cachingNeeds caching pluginNeeds caching pluginLiteSpeed Cache plugin (very fast)
Memory usageVery lowHigher (per-process)Low
Config syntaxNginx blocksApache directivesApache-compatible
PHP integrationFastCGI / PHP-FPMmod_php or PHP-FPMBuilt-in LSPHP

Which should you use?

  • Nginx: Best default choice for most VPS setups. Very efficient on low-memory VPS. Good for WordPress with a caching plugin. Does not support .htaccess
  • Apache: Choose Apache if your application relies on .htaccess for routing or per-directory configuration. Slightly higher memory use. More compatible with legacy PHP apps
  • OpenLiteSpeed (OLS): Excellent for WordPress performance, especially with the LiteSpeed Cache plugin. Supports .htaccess. A good middle ground between Nginx speed and Apache compatibility

For new WordPress deployments on a capable VPS, OpenLiteSpeed + LiteSpeed Cache is often the fastest combination. For a simple PHP site or tight memory budget, Nginx is the most efficient.

Install a web server

  1. Go to aaPanel → App Store
  2. Find the web server you want (Nginx, Apache, or OpenLiteSpeed)
  3. Click Install
  4. Wait for installation to complete

aaPanel can have both Nginx and Apache installed simultaneously, though only one should be the primary server on port 80/443. You can use Nginx as a reverse proxy in front of Apache if needed, but for most sites, run one or the other.

Switch web servers

Switching web servers requires reconfiguring all site vHosts

Each web server uses its own configuration format. If you switch from Apache to Nginx after setting up sites, the existing Apache vHost configs are not compatible with Nginx-you must recreate each site's configuration. Always create a full backup before switching.

To switch the active web server on port 80/443:

  1. Stop the current web server: aaPanel → App Store → current server → Stop
  2. Install the new web server if not already installed
  3. Start the new web server
  4. Recreate site vHosts under the new server by visiting each site's configuration in aaPanel → Website

.htaccess on Nginx in aaPanel

If you run Nginx, .htaccess files in your document root are not read. Rules you would normally add to .htaccess must be added to the Nginx site configuration instead:

  • WordPress permalinks: Apply the WordPress URL rewrite template in aaPanel → Website → your site → URL rewrite → select WordPress
  • Custom redirects: Add to the site's Nginx config via Website → your site → Config
  • PHP settings: Use a user.ini file in the document root instead of .htaccess PHP directives

If .htaccess compatibility is essential, use Apache or OpenLiteSpeed instead.

Restart web services safely

Restart or reload the web server from aaPanel to apply config changes:

  • aaPanel → App Store → your web server → Reload (graceful-no active connections dropped)
  • aaPanel → App Store → your web server → Restart (full restart-use when Reload is not sufficient)

Via SSH:

# Nginx
systemctl reload nginx

# Apache
systemctl reload apache2

# OpenLiteSpeed
systemctl restart lsws

Related: What is aaPanel? Overview for UnderHost VPS customers | Create a website in aaPanel | How to create a WordPress site in aaPanel | aaPanel troubleshooting-common issues and fixes

Was this article helpful?

Need aaPanel hosting?

Install aaPanel on an UnderHost VPS or dedicated server when you want a simple web interface for sites, databases, SSL, and apps.

Related articles

Back to aaPanel