{"id":4055,"date":"2022-05-24T16:27:00","date_gmt":"2022-05-24T21:27:00","guid":{"rendered":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/"},"modified":"2026-03-06T15:44:10","modified_gmt":"2026-03-06T21:44:10","slug":"nginx-vs-apache-wordpress","status":"publish","type":"post","link":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/","title":{"rendered":"NGINX vs Apache: What\u2019s the Best Web Server for WordPress?"},"content":{"rendered":"<p data-analytics-track-visibility=\"yes\">To run a WordPress website, you need to host it on a web server. This is what enables web browsers to request your site\u2019s data. However, there are several web server options, which can make choosing one a daunting task.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">While there are many web servers to choose from, <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/httpd.apache.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Apache<\/a> and <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.nginx.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">NGINX<\/a> are the most popular options. But which of the two is the best web server?<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">These two web servers handle <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/w3techs.com\/technologies\/overview\/web_server\" target=\"_blank\" rel=\"noreferrer noopener\">over 50%<\/a> of all web traffic. While they share many qualities, there are differences you need to know about that can help you choose the right one for your site.&nbsp;In this article, we\u2019ll discuss the differences between NGINX and Apache. We\u2019ll then look at how you can install WordPress on both types of servers. Let\u2019s get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-comparing-performance-nginx-vs-apache\" data-analytics-track-visibility=\"yes\">Comparing performance: NGINX vs Apache<\/h2>\n\n\n\n<p data-analytics-track-visibility=\"yes\">As we mentioned earlier, NGINX and Apache are the most prominent web server options. They can handle diverse workloads and work with other software to form <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/wordpress-glossary\/\" target=\"_blank\" rel=\"noreferrer noopener\">LAMP and LEMU stacks<\/a>. However, in order to accurately compare these web servers, you\u2019ll need to understand how they differ.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-apache\" data-analytics-track-visibility=\"yes\">Apache<\/h3>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Apache is the older of the two servers, and was first released and developed by the Apache Software Foundation in 1995 by Robert McCool. Since 1996 Apache has been the top web server, and it is used by <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/w3techs.com\/technologies\/details\/ws-apache\" target=\"_blank\" rel=\"noreferrer noopener\">approximately 38.7%<\/a> of websites. Currently, the Apache Foundation continues to release versions for Apache.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">The Apache module provides a range of benefits, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\" data-analytics-track-visibility=\"yes\">\n<li><strong>Preinstallation options: <\/strong>Apache comes pre-installed on major Linux distributions.&nbsp;<\/li>\n\n\n\n<li><strong>User community: <\/strong>Apache has a large user community offering help to one another.&nbsp;<\/li>\n\n\n\n<li><strong>Dynamic module loading system: <\/strong>This system stops you from touching the main package when updating the server.<strong>&nbsp;<\/strong><\/li>\n\n\n\n<li><strong>URL rewrites in <em>.htaccess<\/em>: <\/strong>Apache 2 uses <em>mod_rewrite<\/em> for clean rewrites.<\/li>\n\n\n\n<li><strong>Modular design: <\/strong>Apache offers greater customization and flexibility due to the modular design.<strong>&nbsp;<\/strong><\/li>\n\n\n\n<li><strong>Server configuration using the <em>httpd.conf<\/em> file: <\/strong>Configuration is easy, as you do not need to access the main <em>apache2.conf<\/em> file.<\/li>\n\n\n\n<li><strong>Act as \u201cgateway\u201d server:<\/strong> Apache can also serve the function as a reverse proxy server.<\/li>\n<\/ul>\n\n\n\n<p data-analytics-track-visibility=\"yes\">The Apache server is a user-friendly web server with lots of customization features. The software is also compatible with Unix and Windows servers.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-nginx\" data-analytics-track-visibility=\"yes\">NGINX<\/h3>\n\n\n\n<p data-analytics-track-visibility=\"yes\">NGINX was released in 2004 by Igor Sysoev, found of NGINX Inc., to solve <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"http:\/\/www.kegel.com\/c10k.html\" target=\"_blank\" rel=\"noreferrer noopener\">the C10K problem<\/a>. This is the challenge web servers face when handling 10,000 or more concurrent connection requests.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">To solve this, NGINX was developed as an asynchronous, non-blocking, and event-based architecture. This is one of the primary differences between NGINX and Apache. It is also one of the reasons why <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/w3techs.com\/technologies\/details\/ws-nginx\">approximately 32.1% of websites use NGINX<\/a>.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">There are many other benefits that NGINX provides, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\" data-analytics-track-visibility=\"yes\">\n<li><strong>Lightweight design<\/strong>: NGINX can run on minimal hardware, and uses less memory than Apache.&nbsp;<\/li>\n\n\n\n<li><strong>Static content handling<\/strong>: NGINX offers better static content handling when configured correctly.&nbsp;<\/li>\n\n\n\n<li><strong>Heavy load responsiveness<\/strong>: NGINX remains highly responsive when there is heavy traffic.&nbsp;<\/li>\n\n\n\n<li><strong>User-friendly design<\/strong>: The learning curve is easier, and NGINX is beginner-friendly.&nbsp;<\/li>\n\n\n\n<li><strong>Modular setup<\/strong>: The design of this server allows for flexible builds and a range of <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.nginx.com\/resources\/wiki\/modules\/\" target=\"_blank\" rel=\"noreferrer noopener\">third-party modules<\/a>.&nbsp;<\/li>\n\n\n\n<li><strong>Reverse proxy: <\/strong>NGINX Plus offers a software based reverse proxy with similar capabilities to hardware-based solutions at a lower cost.<\/li>\n<\/ul>\n\n\n\n<p data-analytics-track-visibility=\"yes\">NGINX and NGINX Plus are often seen as better options for high-traffic websites because of its load balancing capabilities to handle heavier loads. It\u2019s also ideal for maintaining top performance on sites with a lot of static web content.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-differences-between-apache-vs-nginx\" data-analytics-track-visibility=\"yes\">Differences between Apache vs NGINX<\/h2>\n\n\n\n<p data-analytics-track-visibility=\"yes\">While NGINX and Apache HTTP Server are similar, there are many differences between the two. The biggest distinction is the way these web servers handle multiple client requests. Apache uses a forked solution, while NGINX uses a non-blocking event loop.&nbsp;<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Apache provides <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mpm.html\" target=\"_blank\" rel=\"noreferrer noopener\">Multi-Processing Modules<\/a> (MPMs) that dictate how request handling works. The forked approach makes swapping out connection handling architecture easier. The modules used in this approach are additions to the core functionality of Apache. Each Multi-Processing Module starts a different process for handling server requests.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">One example is <em>mpm-worker<\/em> \u2013 a module that creates processes handling multiple threads. Each thread is a single connection to the server. Adding this module allows scaling of the server and enables the management of large amounts of traffic.&nbsp;<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">NGINX is different and spawns only worker processes for simultaneous request handling. These processes are non-blocking events that continuously check for and process multiple requests. This continuous checking creates a loop. All events in the loop are asynchronous and are removed from the loop when the connection closes.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-whats-the-best-wordpress-web-server-software\" data-analytics-track-visibility=\"yes\">What\u2019s the best WordPress web server software?<\/h2>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Both Apache and NGINX work well with <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/wordpress-hosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress hosting<\/a>. However, NGINX might be the better option if you want improved performance. Let\u2019s take a look at how to install WordPress on both types of servers, so you\u2019ll be ready to get started with either one.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-how-to-install-wordpress-on-apache\" data-analytics-track-visibility=\"yes\">How to install WordPress on Apache<\/h3>\n\n\n\n<p data-analytics-track-visibility=\"yes\">To install WordPress on Apache, you will need to set up a LAMP (<a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.linux.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Linux<\/a>, Apache, <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/resources\/mysql-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL<\/a>, and <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/php-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">PHP<\/a>) stack. This is generally done on an Ubuntu server.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-1-create-a-sudo-user-on-your-server\" data-analytics-track-visibility=\"yes\">Step 1: Create a sudo user on your server<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">To create a user, log into your server as <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/linuxize.com\/post\/how-to-create-a-sudo-user-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">the root user<\/a>. Then use the <em>add user<\/em> command below to create a new account:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ adduser username<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">The server will prompt you to set and confirm a password. Next, fill in the details for the user. Then you can provide <em>sudo<\/em> access to that user. This access allows the user to execute commands that are normally completed by the root user.&nbsp;<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">To add the user to a <em>sudo<\/em> group, enter the following command:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ usermod -aG sudo username<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Then, you\u2019ll want to log into the server as the sudo user for the rest of the installation process.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-2-install-apache-web-server\" data-analytics-track-visibility=\"yes\">Step 2: Install Apache web server<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">To <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/httpd.apache.org\/docs\/current\/install.html\" target=\"_blank\" rel=\"noreferrer noopener\">install Apache<\/a>, you will need to use the Ubuntu package manager <em>apt<\/em>. This is the default on Ubuntu servers. Entering the following <em>sudo<\/em> command starts the installation after you enter your password:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo apt update\n$ sudo apt install apache2<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">You\u2019ll then see the packages that will be installed, and how much disk space is required. Press <em>Y<\/em> and then <em>Enter<\/em> to start the installation.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-3-install-mysql-database-server\" data-analytics-track-visibility=\"yes\">Step 3: Install MySQL database server<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Next, you\u2019ll need to install the database management system MySQL. The following command in the package manager will start the installation:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo apt install mysql-server<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">The packages and disk space required will be displayed again. To start the installation, press <em>Y<\/em> and set the root password.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-4-install-php\" data-analytics-track-visibility=\"yes\">Step 4: Install PHP<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">PHP is the part of your LAMP stack that processes code to dynamic content. <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/linuxize.com\/post\/how-to-install-php-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">To install it<\/a>, you should enter the following command:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo apt install php libapache2-mod-php php-mysql<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">PHP should then install without any problems. You\u2019ll need to restart the server to complete the stack installation. To do so, enter the following command:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo systemctl restart apache2<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Your LAMP stack is now installed and configured.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-5-set-up-virtual-hosts\" data-analytics-track-visibility=\"yes\">Step 5: Set Up virtual hosts<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\"><a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/httpd.apache.org\/docs\/2.4\/vhosts\/\" target=\"_blank\" rel=\"noreferrer noopener\">Virtual hosts<\/a> encapsulate configuration details, and are a recommended step. The encapsulation lets you host more than one website on a server.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Apache servers default to <em>\/var\/www\/html<\/em> directories that are unwieldy for multiple websites. To create a virtual host, you\u2019ll need to set up a directory structure in <em>\/var\/www<\/em> for the new website\u2019s domain.&nbsp;<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Use the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04\" target=\"_blank\" rel=\"noreferrer noopener\">following command<\/a> to create this structure:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>sudo mkdir \/var\/www\/new_domain<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Change <em>new_domain<\/em> to the domain of your website. Then create an <em>index.html<\/em> file with sample content using the <em>nano<\/em> command:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ nano \/var\/www\/new_domain\/index.html<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">To ensure that Apache serves your content, you\u2019ll also need to create a host file. The following command creates the configuration file:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo nano \/etc\/apache2\/sites-available\/your_domain.conf<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Then add the following configuration block:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n    ServerAdmin webmaster@localhost\n    ServerName new_domain\n    ServerAlias www.new_domain\n    DocumentRoot \/var\/www\/new_domain\n    ErrorLog ${APACHE_LOG_DIR}\/error.log\n    CustomLog ${APACHE_LOG_DIR}\/access.log combined\n&lt;\/VirtualHost&gt;<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">The next command enables the file, while the second disables the default site on the server:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo a2ensite new_domain.conf\n$ sudo a2dissite 000-default.conf<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Your virtual host should now be configured and working. This newly-created directory should be used for installing WordPress.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-6-install-wordpress\" data-analytics-track-visibility=\"yes\">Step 6: Install WordPress<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">After configuring your LAMP stack, you can install WordPress. Download the latest version of WordPress and install it with the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/ubuntu.com\/tutorials\/install-and-configure-wordpress#2-install-wordpress\" target=\"_blank\" rel=\"noreferrer noopener\">following command<\/a>:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo apt update\n$ sudo apt install wordpress php libapache2-mod-php mysql-server php-mysql<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Next, <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/ubuntu.com\/tutorials\/install-and-configure-wordpress#3-configure-apache-for-wordpress\" target=\"_blank\" rel=\"noreferrer noopener\">configure Apache<\/a> for WordPress and <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/ubuntu.com\/tutorials\/install-and-configure-wordpress#4-configure-database\" target=\"_blank\" rel=\"noreferrer noopener\">create the MySQL database<\/a>. Then use the WordPress web browser interface to complete the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/ubuntu.com\/tutorials\/install-and-configure-wordpress#5-configure-wordpress\" target=\"_blank\" rel=\"noreferrer noopener\">website configuration<\/a>. This includes creating a site title and setting a password.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-how-to-install-wordpress-on-nginx\" data-analytics-track-visibility=\"yes\">How to install WordPress on NGINX<\/h3>\n\n\n\n<p data-analytics-track-visibility=\"yes\">To install WordPress on NGINX, you need a server running one of the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/unit.nginx.org\/installation\/?_ga=2.164349946.45652302.1588254197-1506587029.1585825834\" target=\"_blank\" rel=\"noreferrer noopener\">distributions that NGINX Unit supports<\/a>. If you are using Linux, you will be creating a LEMU (Linux, NGINX, MySQL, and NGINX Unit) stack.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-1-install-mysql\" data-analytics-track-visibility=\"yes\">Step 1: Install MySQL<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Before starting, create a server user with <em>sudo<\/em> access. Log into your server as the root user, and use the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/linuxize.com\/post\/how-to-create-a-sudo-user-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">following command<\/a> to create a new account:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ adduser username<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">You\u2019ll need to enter and confirm a password before filling the details for the user. Then you can provide <em>sudo<\/em> access to that user. This access enables the user to execute commands that are normally completed by the root user.&nbsp;<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">To add the user to a <em>sudo<\/em> group, enter the following command:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ usermod -aG sudo username<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Log into the server as the sudo user, and use the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.nginx.com\/blog\/installing-wordpress-with-nginx-unit\/#Installing-MySQL\" target=\"_blank\" rel=\"noreferrer noopener\">following command<\/a> to install MySQL:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo apt-get install mysql-server<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Enter a new root password. The MySQL configuration tool can then run. This is a configuration wizard that walks you through the installation process.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-2-create-a-mysql-database\" data-analytics-track-visibility=\"yes\">Step 2: Create a MySQL database<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Once MySQL is ready, you can <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.nginx.com\/blog\/installing-wordpress-with-nginx-unit\/#mysql\" target=\"_blank\" rel=\"noreferrer noopener\">create a new database<\/a>. You\u2019ll also need to create a new user with management permission. To do this, log into the MySQL root account and enter the following commands:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo mysql -u root -p\nmysql&gt; CREATE DATABASE wordpress;\nmysql&gt; CREATE USER user@localhost IDENTIFIED BY 'secure_password';\nmysql&gt; GRANT ALL PRIVILEGES ON wordpress.* TO user@localhost;\nmysql&gt; FLUSH PRIVILEGES;\nmysql&gt; Exit\nBye<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">The Flush Privileges command makes sure that MySQL recognizes the changes you have made. You should change the default username and password to match your preferences.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-3-install-wordpress\" data-analytics-track-visibility=\"yes\">Step 3: Install WordPress<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Before installing WordPress, you should create a temporary file location using the following command:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ cd \/var\/www\/\n$ sudo wget http:\/\/wordpress.org\/latest.tar.gz\n$ sudo tar xzvf latest.tar.gz<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">This command also downloads and unpacks WordPress.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-4-configure-wordpress\" data-analytics-track-visibility=\"yes\">Step 4: Configure WordPress<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Next, create a copy of the WordPress configuration file and rename it using the following commands:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ cd \/var\/www\/wordpress\n$ sudo cp wp-config-sample.php wp-config.php<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">You can update the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/resources\/generate-wordpress-salt-keys\/\" target=\"_blank\" rel=\"noreferrer noopener\">SALT keys<\/a> in the file to improve security. Using <em>nano<\/em> opens the <em>wp-config.php<\/em> file, and enables you to search for the SALT keys:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo nano wp-config.php<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">Replace the keys with <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/\" target=\"_blank\" rel=\"noreferrer noopener\">newly-generated ones<\/a>, and then save and exit the file.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-5-install-php\" data-analytics-track-visibility=\"yes\">Step 5: Install PHP<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">While you can use NGINX Unit, you should still install PHP. You can use the following command to do so:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo apt-get install -y php7.0 php7.0-common php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">This is necessary because WordPress relies on several extensions that are not included in NGINX Unit.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"toc-step-6-install-nginx-unit\" data-analytics-track-visibility=\"yes\">Step 6: Install NGINX Unit<\/h4>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Finally, you will need to install the precompiled NGINX Unit for your server\u2019s operating system. Use the following command to install the module for PHP:<\/p>\n\n\n<div class=\"wp-block-code-wrapper wp-block-acf-code\" data-analytics-track-visibility=\"yes\">\n\t<pre class=\"wp-block-code\"><code>$ sudo apt-get install unit-php\n$ sudo service unit restart\n$ sudo curl -X PUT --data-binary @\/usr\/share\/doc\/unit-php\/examples\/unit.config --unix-socket \/run\/control.unit.sock http:\/\/localhost\/config \n$ curl http:\/\/localhost:8300\/<\/code><\/pre>\n\t<div class=\"wp-block-code-controls\">\n\t\t<button class=\"wp-block-code-button\" aria-label=\"Copy code to clipboard\" type=\"button\"><svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M5 2C3.34315 2 2 3.34315 2 5V16C2 16.5523 2.44772 17 3 17C3.55228 17 4 16.5523 4 16V5C4 4.44772 4.44772 4 5 4H16C16.5523 4 17 3.55228 17 3C17 2.44772 16.5523 2 16 2H5Z\" fill=\"currentColor\" \/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 6C7.34315 6 6 7.34315 6 9V19C6 20.6569 7.34315 22 9 22H19C20.6569 22 22 20.6569 22 19V9C22 7.34315 20.6569 6 19 6H9ZM8 9C8 8.44772 8.44772 8 9 8H19C19.5523 8 20 8.44772 20 9V19C20 19.5523 19.5523 20 19 20H9C8.44772 20 8 19.5523 8 19V9Z\" fill=\"currentColor\" \/><\/svg><\/button>\n\t\t<span class=\"toast\" role=\"status\" aria-live=\"assertive\"><\/span>\n\t<\/div>\n<\/div>\n\n\n<p data-analytics-track-visibility=\"yes\">These commands also verify that NGINX Unit and PHP are working properly.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Next, you need to install and configure <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/docs.nginx.com\/nginx\/admin-guide\/installing-nginx\/installing-nginx-open-source\/\">NGINX Open Source<\/a>. You can install a <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/nginx.org\/en\/download.html?_ga=2.160673016.45652302.1588254197-1506587029.1585825834\">pre-built package<\/a> from the mainline branch. These include the latest features and patches. After this configuration, WordPress will be ready to use.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-keep-learning-with-wp-engine\" data-analytics-track-visibility=\"yes\">Keep learning with WP Engine<\/h2>\n\n\n\n<p data-analytics-track-visibility=\"yes\"><a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/httpd.apache.org\/\">Apache<\/a> and <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.nginx.com\/\">NGINX<\/a> are the most popular web server software options. But in the battle between NGINX vs Apache, which one comes out on top? While they are similar in many ways, the NGINX server does provide better performance for high-traffic websites. However, Apache has a larger community with more documentation.<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">Of course, you\u2019ll need several things to develop an outstanding website. These include the right tools, the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/developer.wordpress.org\/\">best resources<\/a>, and <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/plans\/\">top-notch web hosting<\/a>!<\/p>\n\n\n\n<p data-analytics-track-visibility=\"yes\">For more SEO and web-related resources about <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/resources\/wordpress-plugins-site-optimization\/\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress optimization<\/a> and <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/resources\/http-400-error-codes\/\" target=\"_blank\" rel=\"noreferrer noopener\">understanding HTTP 400 Errors<\/a>, check out our Resource Center to improve your site.<\/p>","protected":false},"excerpt":{"rendered":"<p>To run a WordPress website, you need to host it on a web server. This is what enables web browsers to request your site\u2019s data. However, there are several web server options, which can make choosing one a daunting task. While there are many web servers to choose from, Apache and NGINX are the most [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":1837,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":true,"mediapress_draft_name":"","_mediapress_is_draft_copy":false,"_time_to_read":11,"footnotes":""},"audience":[],"blog-category":[123],"buyer-stage":[],"company-and-culture":[],"content-type":[43],"location":[],"persona":[106],"product":[],"topic":[95],"use-cases":[],"class_list":["post-4055","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","blog-category-industry-innovation","content-type-article","persona-developer","topic-development"],"acf":{"hero_image_alt_text":"","featured_on_hub_page":false,"featured_on_tag_page":false,"featured_on_category_page":false,"wp_engine_pick":false,"display_author_bio":false,"taxonomy_selector":{"":null,"taxonomy-audience":false,"taxonomy-buyer-stage":false,"taxonomy-company-and-culture":false,"taxonomy-content-type":[43],"taxonomy-location":false,"taxonomy-persona":[106],"taxonomy-product":false,"taxonomy-topic":[95],"taxonomy-use-cases":false}},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Nginx vs Apache: Best Web Server for Wordpress?<\/title>\n<meta name=\"description\" content=\"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Nginx vs Apache: Best Web Server for Wordpress?\" \/>\n<meta property=\"og:description\" content=\"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-24T21:27:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-06T21:44:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPE-IMG-Thumbnail-1200x630-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"WP Engine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Nginx vs Apache: Best Web Server for Wordpress?\" \/>\n<meta name=\"twitter:description\" content=\"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.\" \/>\n<meta name=\"twitter:creator\" content=\"@wpengine\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"WP Engine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/\"},\"author\":{\"name\":\"WP Engine\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/person\\\/bf22ca48719dba40ad1a1d4161eb01e9\"},\"headline\":\"NGINX vs Apache: What\u2019s the Best Web Server for WordPress?\",\"datePublished\":\"2022-05-24T21:27:00+00:00\",\"dateModified\":\"2026-03-06T21:44:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/\"},\"wordCount\":1907,\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/nginx-vs-apache-featured.jpg\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/\",\"name\":\"Nginx vs Apache: Best Web Server for Wordpress?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/nginx-vs-apache-featured.jpg\",\"datePublished\":\"2022-05-24T21:27:00+00:00\",\"dateModified\":\"2026-03-06T21:44:10+00:00\",\"description\":\"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/nginx-vs-apache-featured.jpg\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/nginx-vs-apache-featured.jpg\",\"caption\":\"NGINX vs Apache: What\u2019s the Best Web Server for WordPress? IT Engineer Standing Beside Open Server Rack Cabinets\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/nginx-vs-apache-wordpress\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpengine.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"NGINX vs Apache: What\u2019s the Best Web Server for WordPress?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#website\",\"url\":\"https:\\\/\\\/wpengine.com\\\/\",\"name\":\"WP Engine\u00ae\",\"description\":\"Managed Hosting for WordPress\",\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpengine.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#organization\",\"name\":\"WP Engine\",\"url\":\"https:\\\/\\\/wpengine.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/WPEngine_OGImage-1.webp\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/WPEngine_OGImage-1.webp\",\"width\":1200,\"height\":630,\"caption\":\"WP Engine\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/wpengine\\\/\",\"https:\\\/\\\/x.com\\\/wpengine\",\"https:\\\/\\\/www.instagram.com\\\/wpengine\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpengine\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCJeAEAxX69v24CUBZ0WBYSg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/person\\\/bf22ca48719dba40ad1a1d4161eb01e9\",\"name\":\"WP Engine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"caption\":\"WP Engine\"},\"url\":\"https:\\\/\\\/wpengine.com\\\/blog\\\/author\\\/wp-engine\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Nginx vs Apache: Best Web Server for Wordpress?","description":"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"Nginx vs Apache: Best Web Server for Wordpress?","og_description":"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.","og_url":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/","og_site_name":"WP Engine\u00ae","article_publisher":"https:\/\/www.facebook.com\/wpengine\/","article_published_time":"2022-05-24T21:27:00+00:00","article_modified_time":"2026-03-06T21:44:10+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPE-IMG-Thumbnail-1200x630-1.jpg","type":"image\/jpeg"}],"author":"WP Engine","twitter_card":"summary_large_image","twitter_title":"Nginx vs Apache: Best Web Server for Wordpress?","twitter_description":"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.","twitter_creator":"@wpengine","twitter_site":"@wpengine","twitter_misc":{"Written by":"WP Engine","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/#article","isPartOf":{"@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/"},"author":{"name":"WP Engine","@id":"https:\/\/wpengine.com\/#\/schema\/person\/bf22ca48719dba40ad1a1d4161eb01e9"},"headline":"NGINX vs Apache: What\u2019s the Best Web Server for WordPress?","datePublished":"2022-05-24T21:27:00+00:00","dateModified":"2026-03-06T21:44:10+00:00","mainEntityOfPage":{"@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/"},"wordCount":1907,"publisher":{"@id":"https:\/\/wpengine.com\/#organization"},"image":{"@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2020\/07\/nginx-vs-apache-featured.jpg","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/","url":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/","name":"Nginx vs Apache: Best Web Server for Wordpress?","isPartOf":{"@id":"https:\/\/wpengine.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2020\/07\/nginx-vs-apache-featured.jpg","datePublished":"2022-05-24T21:27:00+00:00","dateModified":"2026-03-06T21:44:10+00:00","description":"Between NGINX vs Apache, which web server is the right one for your WordPress site? Check out our comparison for your WordPress web hosting.","breadcrumb":{"@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/#primaryimage","url":"https:\/\/wpengine.com\/wp-content\/uploads\/2020\/07\/nginx-vs-apache-featured.jpg","contentUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2020\/07\/nginx-vs-apache-featured.jpg","caption":"NGINX vs Apache: What\u2019s the Best Web Server for WordPress? IT Engineer Standing Beside Open Server Rack Cabinets"},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/blog\/nginx-vs-apache-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/"},{"@type":"ListItem","position":2,"name":"NGINX vs Apache: What\u2019s the Best Web Server for WordPress?"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/#website","url":"https:\/\/wpengine.com\/","name":"WP Engine\u00ae","description":"Managed Hosting for WordPress","publisher":{"@id":"https:\/\/wpengine.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wpengine.com\/#organization","name":"WP Engine","url":"https:\/\/wpengine.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/#\/schema\/logo\/image\/","url":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPEngine_OGImage-1.webp","contentUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPEngine_OGImage-1.webp","width":1200,"height":630,"caption":"WP Engine"},"image":{"@id":"https:\/\/wpengine.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/wpengine\/","https:\/\/x.com\/wpengine","https:\/\/www.instagram.com\/wpengine\/","https:\/\/www.linkedin.com\/company\/wpengine\/","https:\/\/www.youtube.com\/channel\/UCJeAEAxX69v24CUBZ0WBYSg"]},{"@type":"Person","@id":"https:\/\/wpengine.com\/#\/schema\/person\/bf22ca48719dba40ad1a1d4161eb01e9","name":"WP Engine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","caption":"WP Engine"},"url":"https:\/\/wpengine.com\/blog\/author\/wp-engine\/"}]}},"mediapress_workflow_parent_id":null,"_links":{"self":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/posts\/4055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/comments?post=4055"}],"version-history":[{"count":0,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/posts\/4055\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/media\/1837"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/media?parent=4055"}],"wp:term":[{"taxonomy":"audience","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/audience?post=4055"},{"taxonomy":"blog-category","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/blog-category?post=4055"},{"taxonomy":"buyer-stage","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/buyer-stage?post=4055"},{"taxonomy":"company-and-culture","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/company-and-culture?post=4055"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/content-type?post=4055"},{"taxonomy":"location","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/location?post=4055"},{"taxonomy":"persona","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/persona?post=4055"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/product?post=4055"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/topic?post=4055"},{"taxonomy":"use-cases","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/use-cases?post=4055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}