SEO Cheat Sheet #6: Linux and Apache Web Server Configurations for High Performance WordPress Websites

In this article we briefly review various settings in Ubuntu Linux and Apache Web Server that are helpful for either performance purposes, search engine optimization (SEO) purposes, or both.

This is the first pass at aggregating this information so if you have ideas for other changes that can be made to achieve a high-performance website or improve SEO (but outside of WordPress) that could be added to this article, leave them in the comments below.

Linux

The web server described here relies on Ubuntu Linux, specifically Ubuntu 18.04.1 LTS, as shown below:

The version of Ubuntu used in this example is "Ubuntu 18.04.1 LTS" via the command "lsb_release -a".

and below we include some configuration options that can be used to facilitate a high-performance WordPress installation, with a particular emphasis on those settings which must be configured in the operating system.

PHP 7.2

According to the article Upgrading Your WordPress Website to PHP 7.2: Everything You Need to Know: “Since mid-2017, WordPress has officially asked their customers to use PHP 7.2 or higher.” — and in fact the WordPress website suggests 7.3 or greater at the time of this writing so if you’re stuck on an old version of PHP it’s time to upgrade or consider finding a new provider and moving your website.

PHP FPM (FastCGI Process Manager)

The PHP FPM module is required for the Apache MPM event module, which we’ll look at in a moment. Briefly, the PHP-FPM (FastCGI Process Manager) module “…is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites” (see PHP-FPM – A simple and robust FastCGI Process Manager for PHP).

SSL Certificate and HTTPS

It’s easy enough to secure an entire website and it can help with SEO as well — see the articles below for more information. Installing an SSL cert in Apache is fairly straightforward — real about Apache Module mod_sslmod_ssl on Wikipedia, and HTTPD – Apache2 Web Server: HTTPS Configuration on Ubuntu.

Apache Web Server

In this example we’re using the Apache web server and we’re going to cover briefly the Apache MPM event and PageSpeed modules.

Apache MPM event

From the Apache MPM event page: “The event Multi-Processing Module (MPM) is designed to allow more requests to be served simultaneously by passing off some processing work to the listeners threads, freeing up the worker threads to serve new requests”.

From Understand The Apache Event MPM, “On high-traffic websites, an alternate MPM (the event MPM) is preferable because it has the ability to serve a large amount of requests while maintaining low memory usage.” and, from the same article, “[b]ecause PHP is not thread-safe on Unix environments (in particular many of its most popular extensions), it is not possible to embed an interpreter in each event MPM process. It needs to live as a separate PHP-FPM process. Apache will serve all static resources (images, CSS, etc.) directly while PHP-FPM serves the PHP-related requests.” — so, as mentioned previously, PHP FPM is a precondition for using the Apache MPM event module.

Apache PageSpeed

From modpagespeed.com, “The PageSpeed Modules, mod_pagespeed and ngx_pagespeed, are open-source webserver modules that optimize your site automatically”.

Some of what the Apache PageSpeed module offers can be found in various WordPress plugins however be advised that mixing Apache PageSpeed with W3 Total Cache, in particular, on the same server can be problematic and/or temperamental and may require considerable testing to find the correct configuration. One other drawback of the Apache PageSpeed module is that the server configuration becomes a bit more complex and changes to PageSpeed have to be performed via the command line whereas with W3 Total Cache the change can be made entirely in the WordPress dashboard.

The Apache PageSpeed module is, however, a very powerful module which can improve site performance considerably.

Apache PageSpeed and WordPress Caching Plugins

Apache PageSpeed and WordPress Caching plugins can be used together to achieve excellent performance results however be aware that there can be overlap in the functionality that both tools provide and if you’re not careful this can result in various problems, which we’ll cover briefly here.

Below I’ve included an outline of the flow of a request from visitors through the Apache Web Server to a WordPress Cache Plugin and back, passing through the Apache PageSpeed module and then returning to the visitor.

No alt text provided for this image

What’s important to keep in mind is that if the Cache Plugin offers the ability to, for example, compress content, minify and combine JavaScript and CSS files, and distribute content via a CDN, it’s important to not do this in two places as this can cause several problems: duplicated effort (compress in the WordPress cache only to uncompress in Apache PageSpeed and compress again), unnecessary effort (distributing content via a CDN twice), and strange behavior (minifying twice will cause aberrant behavior).

This issue is serious enough to show up in various discussions involving Apache PageSpeed and WordPress caching plugins so keep this in mind when mixing these two technologies.

Also note that caching plugins can include settings that may interfere with Apache PageSpeed.

See also the article entitled “Optimizing a Complex Site for Pagespeed II“.

HTTP/2

HTTP/2, aka HTTP 2.0, can be beneficial for mainly performance that alone should positively impact SEO.

Adding support for HTTP/2 is a change which can be made relatively quickly and must be done in the Apache web server using the Apache mod_http2 module. Below are several articles which cover HTTP/2 as it applies to both performance as well as SEO.

KeyCDN offers a tool for testing if a website has HTTP/2 enabledGeek Flare also offers a similar tool — see below for an example test executed on https://coherentlogic.com.

A GeekFlare.com http/2 test result.

Conclusion

In this article we covered several technologies that can be used to improve the performance of a WordPress-based website considerably. If you have a high-performance WordPress website and are not using any of the aforementioned solutions, do let me know what your configuration includes in the comments section below along with a description of the page load timings you’ve achieved.

References

  1. Apache2 and php fpm performance optimization — Step-by-step guide
  2. How Migrating Apache MPM from Prefork to Event-based using PHP-FPM saved our day…
  3. PHP-FPM: Process Management
  4. Understand The Apache Event MPM
  5. NGINX vs Apache
  6. Using Apache Bench for Simple Load Testing
  7. How to install PHP 7.1, 7.2 and 5.6 as PHP-FPM & FastCGI for ISPConfig 3 on Debian 9
  8. Google IPv6 Statistics
  9. How To Reduce Server Response Time In WordPress To Under 200ms (The Item From Google PageSpeed Insights)
  10. Average Page Load Times for 2018 – How does yours compare? (see the section entitled “What is the average load time?”)
  11. Load time is out! (see the section entitled “Speed Index, an indicator about UX!”)
  12. How To Integrate Google Page Speed with W3 Total Cache (this is not the Apache PageSpeed module discussed above)
  13. Assess Your Website Performance in under Ten Minutes
  14. SEO Cheat Sheet #2: Page Speed & Image Optimization
  15. SEO Cheat Sheet #5: Delay, Delay, Delay

#SEO #digitalmarketing #webdesign #marketing #wordpress #inboundmarketing #contentmarketing #contentstrategy #searchengineoptimization #linux #ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *