WP Rocket Nginx
WordPress plugin that generates Rocket-Nginx configuration from WP Rocket settings
Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/dvershinin/wp-rocket-nginx/releases/download/v1.0.0/wp-rocket-nginx-1.0.0.zipWP Rocket Nginx is an unofficial WordPress integration that generates a Rocket-Nginx configuration from the active WP Rocket settings. Nginx can then serve existing WP Rocket cache files directly from disk without starting PHP or WordPress.
The plugin does not replace WP Rocket and does not create page-cache files. It mirrors the settings that determine how those files are named and when a request must bypass cache.
Requirements
- WordPress 6.0 or newer
- PHP 7.4 or newer
- Nginx
- WP Rocket for production cache generation
- Permission for the PHP worker to write under
wp-content/
Installation
-
Download
wp-rocket-nginx.zipfrom the latest GitHub release. -
Install and activate it in WordPress.
-
Open Settings > WP Rocket Nginx and confirm that
default.confexists. -
Include the generated file inside the site's Nginx
serverblock:include /absolute/path/to/wp-content/wp-rocket-nginx/default.conf; -
Validate and reload Nginx:
nginx -t && systemctl reload nginx
The configuration regenerates when WP Rocket settings change. Reloading Nginx remains an explicit server operation. This keeps a WordPress administrator from executing server commands through PHP.
What is generated
The default output is:
wp-content/wp-rocket-nginx/default.conf
It includes:
- direct page-cache lookup for desktop, mobile, HTTPS, and gzip variants;
- query-string rules sourced from WP Rocket;
- cache bypasses for POST, authenticated users, carts, and maintenance mode;
- direct Nginx locations for CSS, JavaScript, images, and fonts;
- a deny rule preventing generated
.conffiles from being downloaded; - optional diagnostic
X-Rocket-Nginx-*headers.
Custom Nginx fragments can be placed under
wp-content/wp-rocket-nginx/default/ using Rocket-Nginx's conventions:
start.*.conf, preprocess.*.conf, global.*.conf, http.*.conf,
css.*.conf, js.*.conf, and media.*.conf.
Filters
Server operators can customize advanced values in code:
wp_rocket_nginx_output_pathwp_rocket_nginx_config_namewp_rocket_nginx_wp_content_folderwp_rocket_nginx_query_strings_ignorewp_rocket_nginx_cache_reject_cookieswp_rocket_nginx_mobile_user_agentwp_rocket_nginx_html_cache_controlwp_rocket_nginx_css_expirationwp_rocket_nginx_js_expirationwp_rocket_nginx_media_expiration
The action wp_rocket_nginx_config_written fires after an atomic write.
Development
make test # Fast PHP and configuration checks
make e2e # Real WordPress + Nginx Docker tests
make benchmark # Compare identical responses through Nginx and WordPress/PHP
make package # Build the release zip from committed files
The E2E suite creates real WP Rocket-style cache files and verifies that Nginx serves them. It covers the query-string/mobile path reported by James Garrigan in Rocket-Nginx issue #232.
Credits and license
The Nginx template is derived from Rocket-Nginx 3.1.2 by Maxime Jobin and SatelliteWP. See NOTICE for attribution.
Released under the MIT License. WP Rocket is a trademark of WP Media. This project is independent and is not affiliated with or endorsed by WP Media.
Releases
1 release. Each count is every asset in that release; expand a row for the breakdown.