Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two servers, both with self domain 1st 2nd

and now I would like to setup CDN of to

but I dont know how setup DNS or Apache that, so both servers served files for request

... I don't need solve databases, sessions or someting else... but I need know, how to do that both server will available as

share|improve this question

migrated from Feb 11 '11 at 12:49

This question came from our site for pro webmasters.

This is probably more relevant on ServerFault, seems like an Apache question. – aendrew Feb 11 '11 at 8:23

You cannot build a CDN with two servers.

A real Content Delivery Network (CDN) has servers on several continents, and routes the end users to a server near him by means of TCP/IP Anycast, geo-aware DNS, HTTP redirects and HTTP proxying, or more likely combinations thereof.

Your question is vague to the point of being un-answerable. If you just want to have both servers serve files for without any high-availability, you could use DNS Round Robin for, and set up your second Apache to also answer requests for this hostname via a name-based virtual host.

share|improve this answer
+1 That's "BGP Anycast"; otherwise correct. – Chris S Feb 11 '11 at 13:23

You can do DNS round-robin "load balancing". But for a simple CDN solution check out

share|improve this answer

That's quite a big question your asking, and not an easy one if your not familiar with DNS or Apache, but first can I ask what you're looking to achieve by using a CDN? Do you have a current issue you're working around by investigating a CDN?

It's not what I would call a CDN, but the quickest way to achieve want you have described is to have a caching proxy (squid to name a common one) , which you point domain1 to. Then the proxy goes off to domain2 when it needs content it doesn't have in the cache. If a visitor hits the proxy and it already has the file they are asking for in cache, it will be served from there rather than domain2.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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