Symfony2 Capistrano deploying to CDN

2019-07-11 05:31发布

问题:

I've got a Symfony2 application which I am deploying to development, staging and production servers using Capistrano. However, I'm looking to also setup a CDN to serve static content such as images, css, js files etc. The URL for the CDN for example is static.example.com. I've read that I simply need to add the following to my config_prod.yml file:

framework:
     templating:
         engines: ['twig']
         assets_base_urls:
         http: [http://static.example.com]

However, when deploying using capistrano would I need to deploy the whole application to the CDN as well as the server that will host the website or can I deploy only the assets i.e images, js files etc to the CDN and the dynamic files to the server/s?

Thanks

回答1:

Only static assets needs to be served by your CDN.

See also: automatic push to CDN deployment strategy