How to enable Varnish for Magento 2 on Nexcess Cloud

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

  1. Log in to your Client Portal. From the home page, click Services > Cloud Accounts.

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

  3. Select Menu > Containers.

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

  5. 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.

  6. 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

  1. Verify your Magento 2 store is in production mode. To display the current mode from the command line, issue:
    php bin/magento deploy:mode:show
    See the Magento 2 documentation for information about changing modes.

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

  3. Select Stores < Configuration.

  4. Scroll down and select Advanced > System.

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

  6. Under Varnish Configuration, in the Backend host field, enter the hostname you were provided in Step 1F. In the Backend port field, enter one of the ports provided in the same step.

  7. Click Save Config.

  8. 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

  1. From the command line, enter:
    php bin/magento cache:status
  2. If you see a 0 next to full_page, as below:

    Then, enter:
    php bin/magento cache:enable full_page

 

For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.