Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Launch PHP Websites and Applications in seconds through our 1-Click App Install Launch Now!

Leverage the Power of CDN in Symfony 3 Applications

Updated on October 10, 2017

3 Min Read
Reading Time: 3 minutes

Over years, Symfony has consolidated its position as the preferred development framework for PHP projects. With the recent release of Symfony Flex, the framework is now in a great position to help developers launch RAD enabled apps quickly.

At Cloudways, we try to facilitate Symfony developers in launching their projects without worrying about the hassles of server management. Our about-to-be-released Content Delivery System (CDN) is a continuation of this commitment. In this article, I will go over the process of enabling and configuring Cloudways CDN for your Symfony applications.


  1. Cloudways server with PHP application
  2. Symfony installed on the server (or Symfony Flex enabled application)
  3. Your domain should be mapped

You might also like: Install Symfony 4 On Cloud

You can follow the following GIF to launch a server and a PHP application on Cloudways. By default, you will get PHP 7.0; however, you could downgrade or upgrade to PHP 5.6 or 7.1.

First of all, let’s talk about CDN, and why you need to integrate it into Symfony projects.

What is CDN ?

A CDN is a system of multiple servers which delivers static content (such as text, images) to the users. Instead of serving the static content from the original server, a CDN ensures that the user is served the data from the nearest location (a.k.a., points of presence, or PoPs). Each PoP contains a number of caching servers responsible for content delivery to visitors within its proximity.


Why CDN is Necessary?

CDN ensures speedy delivery of content, thus improving the speed of websites and web apps deployed on any PHP MySQL Hosting. When a CDN is active, the actual location of the website does not matter. The CDN ensures that the visitor receives the data from the nearest location. Since Symfony is well known for powering fintech and ecommerce applications,  CDn plays a central role in speeding up the user experience.

Enable CDN for PHP Apps on Cloudways

When you login to your server, move to the Application tab and open the PHP application. You will see the tab for configuring CDN at the end of the options. When you click the tab, you will enter the CDN configuration screen. Here you will find the URL of the application to be inserted in the WEBSITE URL field and click the Create button.

Next you will get the newly generated URL for you Symfony application:

Few things to note here:

  1. You can view the bandwidth usage on this screen.
  2. You can always purge old content from CDN by using the Purge button.
  3. You can always remove your subscription anytime.

Integrate CDN URL in Symfony Assets

Symfony provides easy configuration options for CDN services. If you know about `base_url`, you are good to go. In the standard Symfony installation, move to `app >> config` and open config.yml.

You need to find the asset settings in framework configs. Since our CDN is asset based, I will concatenate on the CDN Url as base_url to every asset file in Symfony.

          - ''

Now clear your cache by running `rm -fr var/cache/*` and check your Symfony application asset URL’s:

If you are using Symfony Flex for application management, then in your project folder, move to `config >> packages` folder and open framework.yaml file. Add the same asset config as shown above.


Cloudways have partnered with StackPath (formerly known as MaxCDN) and provide one-click activation for the Cloudways CDN. Note that, for a single website, the Monthly Subscription costs $1 per 25GB of bandwidth. You can avail this for any PHP website and framework based application.

Share your opinion in the comment section. COMMENT NOW

Shahroze Nawaz

Shahroze is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. Besides his work life, he loves movies and travelling. You can email him at

Launch PHP websites without the worry of Server Management.

Pre-Installed Optimized Stack with Git, Composer & SSH

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!