Help Docs Control Panel Guides Nexcess Control Panel Nexcess Managed Magento Nexcess Managed Magento Store Management How to enable Varnish for Magento 2 on Nexcess Cloud

How to enable Varnish for Magento 2 on Nexcess Cloud

Enable Varnish for Magento 2 on the Nexcess Cloud infrastructure. Learn how Nexcess Cloud clients can enable Varnish, a web application accelerator for static images.

Prerequisites

  • 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 by step instructions

  1. Log in to my.nexcess.net.

  2. From the home page, click Plans.

  3. From the home page, click your desired Magento cloud service. 

  4. Select Menu > Containers

  5. In the Varnish section on the Containers page, click Enable.

  6. Choose your plan, then click Enable.

  7. Allow a few moments for setup to complete, then note the hostname and port information.

  8. Log in to your Magento 2 admin panel. To do this from your Client Portal, select Menu > Environment, then click App Admin.

  9. Select Stores < Configuration.

  10. Scroll down and select Advanced > System.

  11. Select Full Page Cache. In Caching Application, clear the Use system value check box, then select Varnish Cache (Recommended).

  12. Under Varnish Configuration, in the Backend host field, enter the hostname you were provided from Step 7. In the Backend port field, enter the number for “Main Port”.

  13. Click Save Config.

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

Verify full-page caching is enabled

  1. From the command line, enter:
php bin/magento cache:status

If you see a 0 next to full_page, as below:


Then, enter:

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. Click on the Purge Cache button which will clear the NGNIX micro-cache and the Varnish page cache.

Was this article helpful?