InMotion Hosting Support Center

In this article, we will explore each of the components that make up InMotion Hosting’s WordPress Optimized stack, point out a few potential pitfalls, and explain how each of the components work. Our goal: to get a potential WordPress site owner or webmaster up-to-speed on the important points of this new platform and provide tools to tackle potentially more complex challenges they might later encounter.

This article applies to WordPress Hosting and our WordPress & PHP VPS stacks.

Stack Overview

Those already familiar with cPanel, the popular web hosting control panel, will feel right at home. Still at the heart of each server, cPanel allows simple (but powerful) control over everything from email account creation to SSH key management. Site owners can add domains, subdomains, and parked domains via the cPanel interface, and the Apache and NGINX configurations will reflect these changes.

NGINX handles all inbound requests for each website. It checks each incoming request for a match in the domain’s page cache. If it finds a match, the cached page displays for the site visitor. In so doing, the server does not have to run any PHP code or execute MySQL queries, making for a speedy response. When possible, NGINX directly serves static assets (such as CSS, scripts, and images).

On the other hand, should NGINX fail to find a cached page matching the request, it passes the request along to Apache and waits for the response. Apache continues to serve as the origin for site content, meaning you can continue to use .htaccess files (e.g., permalinks and redirects will work without a problem, in most cases). Next, the server passes page requests along to a PHP-FPM pool allocated for each domain. The PHP-FPM pool delegates the request to an available worker that executes the actual PHP code (such as WordPress itself). The server then feeds the result back up the chain, and NGINX saves a copy of the response in its cache, speeding up future requests.

Wordpress Stack overview
  • ➊  User’s web browser makes request to NGINX to fetch a webpage.
  • ➋  If NGINX fails to find a cached version of the page, or the page has been excluded from caching, NGINX requests the content from Apache.
  • ➌  If a PHP script handles a page, Apache sends the request to the domain’s PHP-FPM pool. The PHP-FPM pool takes .htaccess rewrites and other rules into account, allowing for the use of “pretty URLs” or permalinks.
  • ➍  The PHP-FPM pool then dispatches the request to an available worker (or spawns a new worker if one is not available). The worker then executes the PHP code.
  • ➎  The response travels back up, in reverse, through each of the previous steps, until it returns to the user’s web browser for display.

NGINX

NGINX, a high-performance web server, can completely replace Apache or run alongside it in a reverse-proxy configuration. The WordPress Optimized stack uses the reverse-proxy configuration, meaning that NGINX requests the actual content from Apache. This configuration allows us to perform full-page caching, as well as serve static content (such as images and stylesheets) directly from NGINX. This results in significant speed increases and limits the number of connections to Apache. In other words, this configuration allows the server to deliver cached and static content to the user very quickly.

Caching: How it Works

As mentioned above, when a user visits a page on your website, NGINX first determines whether or not it has a page available in its cache. If so, it checks to see if that page remains valid and has not expired. Note, site owners can control this expiration period via the Cache Manager Plugin. By default, your site will set the expiration time to 4 hours. If a page does not exist in the cache, or you have identified it to the system as a page that should bypass the cache (like a login or checkout page), then the server sends the request to Apache and PHP-FPM, as illustrated in the above stack overview graphic.

To determine which pages NGINX can cache, it examines the headers returned by the server. By default, NGINX ignores Expires and Cache-Control headers. Many WordPress pages return a negative cache time, preventing pages from caching effectively. However, the NGINX Cache Controller plugin can send X-Accel-Expires headers, which the server will use to set and enforce cache times for specific pages.

By default, certain pages will never cache -- specifically, pages that send cookies or use PHP sessions. Therefore, where possible, have any cookies or other dynamic content load asynchronously (via admin-ajax.php). In the Cache Manager Plugin, you also have the ability to match against cookies sent from the user’s browser. This allows us to bypass the cache for logged in users, or for users who have added an item to their shopping cart on a WooCommerce site, for example.

We recommend using the NGINX Helper WordPress plugin to automatically purge cached pages after making changes. This allows the caching layer to work seamlessly with your WordPress installation.

Clearing the Cache

When making changes to your site, or troubleshooting a problem, you may benefit from either clearing a single page or purging the entire cache. In either case, you can easily accomplish this via the Cache Manager Plugin. You can also quickly clear a single page from your browser by prepending /purge to the URI portion. You will then see either a Purge Successful page, or a 404 Not Found page (indicating the page did not exist in the cache). The table below lists a few examples:

URL Purge URL Notes
http://example.com/ http://example.com/purge/ Purges the homepage for example.com
http://example.com/2017/01/cool-article http://example.com/purge/2017/01/cool-article Purges the page at /2017/01/cool-article
Check out our article on the Cache Manager Plugin for more details on tweaking cache settings for your site.

PHP-FPM

An optimized PHP handler, PHP FastCGI Process Manager (PHP-FPM) provides high performance and lower latency page execution. It does this by maintaining and adjusting an on-demand pool of workers for each domain.

Each PHP-FPM master controls a group of pools, with each pool associated with a single domain or virtual host. Each of these pools then handles a group of workers -- the processes that handle the actual execution of PHP code. When the server sends a request to a particular FPM pool, the pool delegates the work to an available worker or spawns a new worker if an existing one is not available (with the on-demand management type). This allows sites that receive a steady stream of traffic to load quicker, as there will typically be a worker available to handle the request. In addition, this architecture allows the workers to share a common pool of memory, permitting the use of opcode caching.

Opcode Caching

By default, your server enables Zend OpCache, PHP’s built-in opcode caching system, for PHP 5.5 and above. Opcode caching works by storing pre-compiled PHP code, which subsequent visitors can later execute again. This saves significant time, CPU usage, and I/O, since PHP does not need to re-interpret and re-compile your PHP code on every single execution.

PHP Configuration

When you add a new user or domain, the server uses the default PHP version. If you wish to experiment with a newer PHP version, or if your application requires an older PHP 5.x version, you can manually select these options from the MultiPHP Manager in cPanel. You can also configure custom PHP options via the MultiPHP INI Editor, or by creating a php.ini file.


Overall, this new platform should offer significant performance gains for most websites (compared to the previous Apache + suPHP stack). The addition of the Cache Manager Plugin will also allow users to further tweak the performance of their sites, to suit their particular needs.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

n/a Points
2018-03-22 5:37 pm

Would the WordPress Optimized stack be recommended for Joomla sites as well?

 

Staff
30,908 Points
2018-03-22 6:41 pm
Since this server setup is optimized for all PHP powered applications, Joomla sites should benefit from the features. Please let us know if you have any further questions.

Thank you,
John-Paul
2018-01-03 11:18 pm
What needs to be done on a dedicated server to be able to use this functionality?
Staff
30,908 Points
2018-01-04 1:16 am
Since our WordPress Stacks are pre-configured you can simply host your WordPress site on the server. We do recommend using the NGINX Helper WordPress plugin to automatically purge cached pages after making changes.

Thank you,
John-Paul
2018-01-03 7:22 pm
So, how does one set this up on a Dedicated server? Do I just need to turn on the PHP-FPM option under the PHP settings in WHM and then add the NGINX Plugin to my WordPress site?
Staff
2,269 Points
2018-01-03 8:26 pm
You would need to request for the WordPress optimized stack. It's not set up for all hosting solutions nor can it be setup in our other hosting environments.
n/a Points
2018-01-03 3:33 pm

Where is the process to move an existing wordpress install over to this new stack?

Staff
41,371 Points
2018-01-03 6:07 pm
Hello,

Thanks for asking the question about migrating to the WordPress optimized stack. You have to talk with our Customer Service team as it changes your hosting account type. They should then provide a ticket to have your site moved after updating your billing information.
n/a Points
2018-01-03 1:14 pm

Hi -

If we currently have a VPS running WordPress sites, what is the best way to migrate to the WordPress Hosting Stack?  Could we keep our same IP address?

Thanks, Neal

Staff
41,371 Points
2018-01-03 1:26 pm
Hello,

Thanks for asking the question about using the WordPress optimized stack and using the same IP. You have to talk with our Customer Service team as it changes your hosting account type. They should then provide a ticket to have your site moved. The IP address would need to be changed as you would using a different server.
n/a Points
2018-01-03 12:19 pm

In my WP i have WP Fastest Cache plugin.  In the above article, is Inmotion saying i need or should install this plugin?  if yes, i'm not sure i) what the plugin name is ii) does it go on/in my WP site iii) or is it something that is on my inmoation cpanel.

can you clarify?  give me advice?

Staff
41,371 Points
2018-01-03 12:21 pm
I answered this question earlier. We have a follow-up article in the works that will detail configurations for WordPress caching. For now, the recommendation is to use the NGINX helper which will ensure that pages get cleared from the cache when changes are made. You can still use W3TC -- we believe W3TC specifically has an option to purge nginx's cache, but you'll need to check their documentation. Usually you wouldn't really want to use additional caching in WordPress, unless you get a lot of members-only traffic, since users who are logged in will bypass any caching.
n/a Points
2018-01-03 11:38 am

Hi! This sounds great. As a reseller hosting Wordpress sites, do we need to make any special requests, or is this now implemented across the board? Thanks.

Staff
41,371 Points
2018-01-03 11:43 am
You would need to request for the WordPress optimized stack. It's not set up for all hosting solutions.
n/a Points
2018-01-03 11:37 am

Will this work with the Wordpress plugins like W3 Total Cache or WP Super Cache? Which provides the fastest service?

Staff
41,371 Points
2018-01-03 12:06 pm
Thanks for the question about using WordPress caching. We have a follow-up article in the works that will detail configurations for caching. For now, the recommendation is to use the NGINX helper which will ensure that pages get cleared from the cache when changes are made. You can still use W3TC -- we believe W3TC specifically has an option to purge nginx's cache, but you'll need to check their documentation. Usually you wouldn't really want to use additional caching in WordPress, unless you get a lot of members-only traffic, since users who are logged in will bypass any caching. Hope that helps!
n/a Points
2018-01-03 11:07 am

thanks for this update1. can I take advantage of this stack for WP installations that are NOT listed with Softaculous?

2. if yes, how? can you please point to a guide on how to set an installation that uses this stack.

ThanksAvi

Staff
41,371 Points
2018-01-03 11:42 am
Hello Avi,

You can use the stack for installations other than what Softauclous provides. We do not have a guide on installing other programs, but it would be like any server installation. Follow the installation instructions for the application want to use. If you require further assistance, then please contact our live technical support team (contact info below).
n/a Points
2018-01-03 10:56 am

So, does all of this happen automatically, or do I have to do something like regenerate Wordpress using the new stack?

Staff
41,371 Points
2018-01-03 12:08 pm
The configuration detailed above is how the WordPress optimized stack is configured. You just have to select the option for your hosting solution.
n/a Points
2018-01-03 10:30 am

Is this already active, or do I have to switch to it?

Staff
41,371 Points
2018-01-03 12:15 pm
The configuration detailed above is how the WordPress optimized stack is configured. You just have to select the option for your hosting solution.
n/a Points
2018-01-03 1:22 pm

Sorry, but your answer isn't very clear. Please clarify: If we need to switch to this new hosting option, how - or where - do we do that? I can't find anything in my C-Panel that mentions NGINX or Wordpress Hosting Stack.

In another response you mentioned that "everything is pre-configured on the server," but it still isn't clear if this option automatically happens for those of us with Wordpress sites, or if/how/where we need to change something from our end.

Please make your responses clear and specific. Vague and incomplete answers are not helpful.

Staff
41,371 Points
2018-01-03 1:29 pm
If you are an existing customer on a different hosting plan, then you would need to speak with our Customer Service team as they would need to change your account to the new hosting solution. They would then provide a ticket to have your site moved to the new hosting type. We have several different types of hosting solutions. If you are a new customer then you would request that hosting type and your account would be created with that specific hosting solution. I hope this helps to clarify the confusion.
n/a Points
2018-01-03 10:25 am

is this available to resellers?

Staff
41,371 Points
2018-01-03 12:19 pm
The WordPress solution is not set up specifically as a reseller solution but you can opt for the VPS version and set it up for reseller purposes.
n/a Points
2018-01-03 10:20 am

Is any configuraion in the cPanel required for the new platform? If so, are there instructions, tutorial for setting it up?

Staff
743 Points
2018-01-03 12:17 pm
There is no additional configuration required in the cPanel, everything is preconfigured on the server.

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

30 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!