Skip to content
WP EngineDocumentation

Install NitroPack on Autoscale

NitroPack page caching relies on advanced-cache.php, a WordPress drop-in that must be present in wp-content/ before WordPress loads. On a traditional install, NitroPack writes this file itself. On Autoscale the filesystem is read-only, so you commit the file to your repository as part of the plugin.

This guide walks through that process. You will copy the file from inside the plugin, fill in four values specific to your environment, and deploy. NitroPack version 1.19.9 or later is required.

  • An Autoscale environment with a working Pipelines deployment
  • A local clone of your site repository
  • Access to the environment’s wp-admin

Version 1.19.9 or later is required.

Terminal window
composer require wpackagist-plugin/nitropack
composer install

Commit the installed files. Do not push yet.

2. Copy advanced-cache.php to the repository root

Section titled “2. Copy advanced-cache.php to the repository root”

From the root of your repository, run:

Terminal window
cp plugins/nitropack/classes/WordPress/AdvancedCache/advanced-cache.php advanced-cache.php

This puts the drop-in at the repository root, which the platform maps to wp-content/advanced-cache.php where WordPress looks for it on every request.

Open advanced-cache.php and replace each placeholder string exactly as shown.

Replace with the absolute path to NitroPack’s functions file on the platform:

/var/www/html/wp-content/plugins/nitropack/functions.php

Replace with the WordPress root path on the platform:

/var/www/html/

Replace with the version string defined in plugins/nitropack/constants.php. Open that file and find the NITROPACK_VERSION constant. Use its value exactly, for example:

1.19.9

Replace with the full name of the WordPress login cookie for your environment. To find it:

  1. Log in to the wp-admin of your Autoscale environment.
  2. Open your browser’s developer tools and go to Application > Cookies.
  3. Find the cookie whose name starts with wordpress_logged_in_. The full name includes a hash unique to your site, for example wordpress_logged_in_5555cc449175b4610722b990886ce0dc.
  4. Use the full cookie name as the replacement value.

Add both files to your repository and get them into the branch your pipeline is watching. For example:

Terminal window
git add plugins/nitropack advanced-cache.php
git commit -m "Add NitroPack with advanced-cache.php drop-in"
git push

Your Pipelines deployment will pick up the commit and build a new image.

Once the deployment completes, go to wp-admin and activate NitroPack. Follow the standard activation flow to connect your NitroPack account and configure the plugin.

In the NitroPack settings, click Go Live to disable test mode. Then check that caching is working by inspecting the response headers on your homepage:

Terminal window
curl -I https://your-autoscale-domain.com/

Look for:

x-nitro-cache: HIT

A HIT value confirms that NitroPack is serving cached responses.

If you deactivate the NitroPack plugin, clear the contents of advanced-cache.php in your repository and redeploy. Leaving the drop-in in place after deactivation will cause errors on every request.

Last updated: