WordPress Caching Solutions Part 2 — Configuring NGINX FastCGI Static Page Caching and Final Load Testing

Page Caching

NGINX FastCGI caching vs Varnish caching

NGINX FastCGI caching vs WP Super Cache

1.Configure NGINX to enable FastCGI caching

fastcgi_cache_path /var/run/nginx-fastcgi-cache levels=1:2 keys_zone=FASTCGICACHE:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
set $skip_cache 0;# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache FASTCGICACHE;
fastcgi_cache_valid 60m;
add_header X-FastCGI-Cache $upstream_cache_status;

2.Install a WordPress NGINX Caching Plugin

3. Verify NGINX Caching is working.

4. Benchmark Performance under load with caching enabled

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

40+ Programming Project Ideas To Level Up Your Skills

Sync your cloud with PTP

“MUSIC ETYMOLOGY” (Skeeter Davis).

How to Learn Python from Zero in 2022: A Comprehensive Guide

Why we started a dev boot camp for women in Utah

Python Tutorial

Drops 11 : Meta Kongz — ‘MKC’

What is a Transparent Proxy and How Does It Work?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Understanding DevOps Tool — Docker Compose

Understanding DevOps Tool - Docker Compose

Connect Docker with Kafka/Postgresql/Cassandra

Kafka , Postgresql , Cassandra inside Docker Container

Project name in docker-compose

Graylog Dashboard for Nginx Logs