Simple Squid based CDN

Building a self made CDN based on Squid server , is a very simple task
all we need to do is tell squid what domains we want to serve , and where
to get its origin files .
The main idea of CDN is to act as reverse proxy for the origin servers ,
most of the cdn providers out works in the same way as we are about to do .
the first step is to prepare the server . in this example i used a clean squid.conf
for the simplicity of things , this was tested on squid version 3.1 but can work with older versions
as well with small changes . so install squid server , then edit your squid.conf file
we are going to proxy 2 domains and .
in order to let squid know the origin ip we are going to use 2 more domains . and now lets explain how it would work in general
1. user request
2. DNS resolve CNAME
3. squid get request for domain and look for its origin peer
4. squid reverse proxy by delivering the files
from back to the user while caching it for the next request .
So now we need to edit squid.conf and make it act as acceleration ( what use to be transparent proxy )
and listen on port 80

http_port 80 accel ignore-cc vhost
acl mysite1 dstdomain
acl mysite2 dstdomain
cache_peer parent 80 0 no-query originserver name=wwwip
cache_peer parent 80 0 no-query originserver name=imgip
cache_peer_access wwwip allow mysite1
cache_peer_access imgip allow mysite2
http_access allow mysite1
http_access allow mysite2
cache_mem 1 GB