How Nexcess Cloud clients can enable Varnish, a web application accelerator for static images.
What you need
Your Client Portal login credentials. If you cannot locate them, click Forgot Password? on the login page.
An existing Nexcess Cloud Magento 2 account. See How to create Nexcess Cloud accounts for more information.
Login credentials and admin access to your Magento 2 store.
Step 1: Enable the Varnish container
Log in to your Client Portal. From the home page, click Plans
From the home page, click your desired Magento cloud service.
Select Menu > Containers.
In the Varnish section on the Containers page, click Enable.
Choose your plan, then click Enable. If you are unsure of which plan to choose, contact our sales team between 9 a.m.–5 p.m. eastern time (ET), Monday through Friday.
Allow a few moments for setup to complete, then note the hostname and port information for use in Steps 2E–2F.
Step 2: Configure your Magento 2 store
- Verify your Magento 2 store is in production mode. To display the current mode from the command line, issue:
php bin/magento deploy:mode:showSee the Magento 2 documentation for information about changing modes.
Log in to your Magento 2 admin panel. To do this from your Client Portal, select Menu > Environment, then click App Admin.
Select Stores < Configuration.
Scroll down and select Advanced > System.
Select Full Page Cache. In Caching Application, clear the Use system value check box, then select Varnish Cache (Recommended).
Under Varnish Configuration, in the Backend host field, enter the hostname in Step 2F you were provided from Step 1F. In the Backend port field, enter the number for "Main Port" that is shown in the Portal (see Step 1F above).
Click Save Config.
To verify the proper flushing of your cache, issue the following, but replace ENDPOINT and PORT with the indicated values.
php bin/magento setup:config:set --http-cache-hosts=ENDPOINT:PORT
Using the information from Step 2F as an example, the command would be:
php bin/magento setup:config:set --http-cache-hosts=us-midwest-1.nxcli.net:1383
Step 3: Verify full-page caching is enabled
- From the command line, enter:
php bin/magento cache:status
- If you see a 0 next to full_page, as below:
php bin/magento cache:enable full_page
Purge the cache in the portal
If you need to purge the Varnish page cache for your site you can do so in the performance menu tab of the portal.
Then click on the Purge Cache button which will clear the NGNIX micro-cache and the Varnish page cache.
Purging the cache in Magento
- To purge the cache using command line, enter:
php bin/magento cache:clean
php bin/magento cache:flush
- To purge the cache from admin, click SYSTEM > Tools > Cache Management, then click Flush Magento Cache at the top of the page.
DISCLAIMER: If you are configuring varnish for a secondary domain, you will need to contact support as the last step to get the domain added to the varnish map.
For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.