Build the own CDN service

apache-2.2cdndomain-name-system

I have two servers, both with self domain
1st www.myexample1.com
2nd www.myexample2.com

and now I would like to setup CDN of www.myexample1.com to www.myexample2.com

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

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

Best Answer

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 www.myexample1.com without any high-availability, you could use DNS Round Robin for www.myexample1.com, and set up your second Apache to also answer requests for this hostname via a name-based virtual host.