Enable cloudfront for wordpress and php app

December 19, 2016 338 views
WordPress PHP Nginx Server Optimization Ubuntu 16.04

we are about to launch a new product and need some help here. this is what we want to achieve.

our main site is on www.example.com which is a wordpress multi-site on sub-directory level. and we have a php app thats on app.example.com
now we want to use aws cloudfront (custom origin) to serve static files(css, js & image) for both the site & application. also is there any way to set certain file types only?
is it possible to have single distribution for both? if yes how can we do that?
even if we need multiple distributions that ok but please give us some guidance here. i have read all the articles from aws but there are not that understandable for newbies like me.

i also want to say, we want to make this without any plugin if possible. because plugins not gonna cover our application and we are really trying to avoid any 3rd party plguin here if possible.

thanks in advance.

1 Answer

I've done a bit of digging and I wasn't able to find any option to use CloudFront for particular types of files on WordPress without the use of a plugin. Since WordPress by default expects it's assets to be on the same host and in particular folders a plugin is required to override this and serve them from a CDN. Another option might be a service like CloudFlare that would work without any custom WordPress settings and automatically cache content, thus improving performance and reducing bandwidth use.

  • Hello @ryanpq
    thanks for the response. actually we tried cloudflare at first position but in our experience with cloudflare for our upcoming project is not that positive so far. No doubt cloudflare is a great product and im an existing client of it for my couple of site. but it seems if i already have a optimized site also an saas based application which is loading pretty fast, adding cloudflare is just degrading our site and saap app performance. and TTFB is something that matter for us. so we decided not to use cloudflare at this moment. maybe we will try it again but with business plan instead when our project has grown enough.

Have another answer? Share your knowledge.