NGINX Configuration for WP Rocket

WP Rocket will work out of the box on NGINX servers. While this configuration is not required, it provides the rules that would otherwise be present in the .htaccess file on Apache servers.

Maxime Jobin has provided us with a configuration for NGINX. From the README file:

It enables NGINX to directly serve previously cached files without calling WordPress or any PHP. It also adds headers to cached CSS, JS, and images via browser cache.

Check it out on GitHub: https://github.com/maximejobin/rocket-nginx

Thanks, Maxime! 🎩

Additional NGINX Tips

  • Read this article in case you have activated WP Rocket’s Mobile Cache option on NGINX.
  • If you're using a custom cache folder, you will need to adjust references to the original cache folder path in the configuration.
  • For users of the NGINX Helper plugin, automatic compatibility exists to purge both the NGINX and WP Rocket cache when either are cleared.

Note: Using the NGINX configuration alone with WP Rocket is generally more performant than using WP Rocket with NGINX caching.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.