How to set up CDN access for Magento 2

    October 12, 2021

    How Nexcess clients can use their Client Portal to configure their Nexcess CDN service for use with their Magento 2 store.

    What you need

    Exception for media assets

    Certain types of content, such as images, video, and audio media assets like JPG, MP3, MP4, and so on, are already compressed. Additional compression to these types of assets will not significantly diminish file size. 


    1: Access the portal

    1. The Nexcess CDN is provided at no cost for your Magento store.
    2. Log in to the Client Portal. From the dashboard, click Plans > Plan Dashboard
    3. In order to be able to use the Nexcess CDN you will need to enable it from the Performance tab. 
    4. Click on Configure CDN on Your Site in the Content Delivery Network section to Enable CDN. A popup will display you will need to click on the ENABLE button. 
    5. Once the CDN has been enabled the CDN origin URL will now show in the Content Delivery Network section of the performance tab. 
    6. Locate the Nexcess CDN information from the Performance tab in the portal. 

    2: Verify settings

    ATTENTION: Allow the CDN service at least one hour to cache your data before you attempt to verify the new settings as outlined below. 

    1. Append /js/mage/cookies.js to your store’s URL. From the example URL shown in the above image, the appended URL would read:
    2. Enter the appended URL into your web browser. If the page loads, your assets have successfully propagated to the CDN and you may proceed to Step 2. If you have already completed Step 2, proceed to the next section.
    1. Update your Magento 2 installation
    2. Update your Magento install to use the CDN origin URL by selecting Stores > Configuration > Web.
    3. From the General tab, select Web
    4. From the Store View drop-down list, select your desired store. 
    5. In the Base URL (Secure) section, in the Base URL for Static View Files and Base URL for User Media Files fields, enter the CDN origin URL. The static view file and user media files will depend on how your Magento 2 store is installed with or without pub in the path.  
    6. If your Magento 2 store is installed with pub, then use:

      If your Magento 2 store is installed without pub, then use:

    7. In the same section, in the Base URL for User Media Files field, the origin URL.
    8. Flush the Magento 2 cache:
      1. From the main menu, select System > Cache Management
      2. On the upper right, click Flush Magento Cache.If you do need to purge the content being stored in the Nexcess CDN you can purge the CDN directly from the portal in the performance tab.
        For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.

    Was this article helpful?

    Send feedback

    Can’t find what you’re looking for?

    Our award-winning customer care team is here for you.

    Contact Support