1

I am developing a Wordpress blog for a client who believes that more than 1m pageviews will be served every month.

Unfortunately his server resources are very limited so I was thinking of hosting the blog - as a static website - on a CDN.

My client intends to publish posts in batches, morning, afternoon and evening so I was thinking of doing the below:

  1. I install the blog on my client's server where my client can manage posts, pages, etc.
  2. Whenever a new post is published, I would create a static .html version of the post and upload it to the CDN. I could use W3 Total Cache or WP Super Cache to create the .html. I would then use the CDN's APIs to upload the file.
  3. In-between batches, when his server is idle, I will re-create the .html of all old posts for areas such as "Latest blog posts", etc.
  4. I update the .html of the old posts on the CDN

Comments in this blog are closed.

Of course when users open the blog at http://www.mydomain.com, this has to be loaded from the CDN(which I believe would be push CDN) and not from the client's server.

I don't want my client's server to be accessed in any way(which I believe would be pull CDN) due to the lack of CPU and memory; it will only be used by the client himself to manage the content.

Is this something I can achieve? My main concern are permalinks, can a CDN replicate the same permalink structure of my blog?

  • Sounds like a fair idea, but a lot of daily work. Unless your working for free your client would likely be better served by upgrading his server a bit and using less of your time. (Time you could potentially be using on other clients.) – KnightHawk Sep 2 '14 at 14:19
  • Unless the domain DNS is pointed directly at the CDN, the server will still need to handle the request. I don't see any gain here, only headaches & fruitless efforts - you'd be much better off switching to cloud hosting, configuring a proxy cache like Varnish, or using the "CDN-ish" proxy service Cloudflare. – TheDeadMedic Sep 2 '14 at 14:51
1

Yes, making static version of WP blog is definite possibility.

I would advise against using caching plugins for that — it's not their purpose and a lot of their functionality tends to depend on elaborate rewrite rules, which you won't be able to replicate on CDN.

There are dedicated WP solutions (none that I have tried), but using generic tool for making static copies might serve you better (this kind of software has a long history and likely many less kinks than something WP–specific).

The permalinks would work, but only so far. Natively WP works by having rewrite process turn "fake" directory structure in the link into data. There is no such step in static sites — actual real directory structure is created and used (with .html files inside). Don't forget that any dynamic links won't work.

My personal opinion is that (depending on your publishing requirements) it might be better to consider solution inherently meant for static sites, rather than WordPress. Such engines actually going through yet another surge of popularity right now (static goes in and out of webdev fashion pretty cyclically every few years).

  • The problem is that the blog is ready and with posts already, can't opt for a different platform :( – WPRookie82 Sep 2 '14 at 16:18
1

CDN is for static content and if your client intends to update his site 3 times a day then the site's content is very far from being static.

It probably can be done, I think there are plugins that can generate static site from wordpress and you don't need to use plugins which are designed for other tasks, and after you generated a static site you can push the files to a CDN, but you need to decide how careful the push should be as during the push the site might not be stable (links going to posts that were not pushed yet). With more content the process will take longer and you need to be careful about keeping the execution time of this process to less then the update interval.

Creating just an HTML version of the post is not enough as you most likely need to update also the home page and RSS.

Another thing to think about is how will you handle form submission, and how your client is going to preview the posts he created.

So, it is possible but as was implied in the comments it might be much more cost effective to upgrade the hosting. With proper caching (which is what is this CDN plan) you should be able to serve a lot of pages even on relatively low cost VPS

  • As a matter or fact what I had in mind was(when posts are published in batch) to a) Update CDN with .html of new posts b) Update RSS feeds + sitemap.xml c) Update Homepage d) Update old posts. In that order. – WPRookie82 Sep 2 '14 at 16:01
  • still if you have a recent posts widget you want it to reflect the newest post ASAP, but the main challenges are anything dynamic which is user initiated. Forms are relatively easy, but does the site have comments (comments can be solved by using external commenting service)? – Mark Kaplun Sep 2 '14 at 16:13
  • True, the most recent posts + feeds are the most important to update immediately. It should take an automated process less than a minute to call 15 pages to generate the .html and update the bucket. No comments, if the client ever wants them I'll use 3rd party like Disqus. All will be automatic by the way, it's the permalinks structure I don't know how to solve :) – WPRookie82 Sep 2 '14 at 16:15
  • "CDN is for static content" Not true anymore, now there are cdn's that can handle dynamic sites and invalidate cache in ms! like Fastly or even cloudfront. – Michael Rogers Jun 5 '18 at 9:09
  • @MichaelRogers, you can invalidate the CDN every nano second, but then it is of not much use and just adds overhead to delivering the html. At some point, CDNs are pointless if you do not have an expectation that the content will be static for non trivial amount of time – Mark Kaplun Jun 5 '18 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.