You may have heard a lot recently about the popular open-source web server application Nginx. It’s one of the most popular and well-regarded open-source software projects in the world.
Along with Apache, PHP, and MySQL, Nginx plays a starring role in our WordPress Hosting stack.
In this article, we’re going to discuss why Nginx is so popular and how we used it to speed up your WordPress experience.
Nginx Plays Middleman In The WordPress Hosting Stack
As you may already know, we use Nginx as a sort of middleman in our WordPress Hosting stack. What does this mean?
- Preserve .htaccess function
- Provide caching
- Lighten the workload for Apache, PHP, and MySQL
Those of you familiar with .htaccess files and how they work with Apache will note an important difference: Nginx does not recognize .htaccess files. Configurations must be made in the server by an experienced system administrator.
This effectively breaks the WordPress “Pretty Permalinks” feature. Furthermore, many of our advanced users rely upon .htaccess to complete all kind of tasks. (Though, we should note, for most users, using a reliable plugin is better than editing .htaccess directly.)
In order to get around this, we use Apache as the main web server and Nginx as a proxy. This means that when a request for a page comes, Nginx first checks to see the if the page being requested has been cached. If that page has been cached then Nginx will serve the cached version. This increases page load speed dramatically because neither PHP nor MySQL are required to generate that page.
This allows Nginx to help Apache, PHP, and MySQL by lightening the work load.
Manual Cache Control
How do you know when a page has expired in the cache? Or, what if you make significant changes to a page and are still seeing a cached version?
If you need to empty the cache for any reason, you can do so with our Cache Manager Plugin in cPanel.
Likewise, you can control your cache directly from within WordPress. We recommend using the Nginx Helper Plugin for WordPress.