Make Own CDN


Hits: 10375  

Well… I am working on alternatives to make OWN CDN…

I have few options to create such CDN

* Google App Engine
http://24ways.org/2008/using-google-app-engine-as-your-own-cdn
http://www.digitalistic.com/2008/06/09/10-easy-steps-to-use-google-app-engine-as-your-own-cdn/

* Amazon EC2

* Wowza
http://www.wowza.com/forums/content.php?81-How-to-achieve-the-lowest-latency-from-capture-to-playback

* GeoIP, NGinx, Bind, Varnish
http://blog.unixy.net/2010/07/how-to-build-your-own-cdn-using-bind-geoip-nginx-and-varnish/
http://www.caraytech.com/geodns/
https://www.varnish-cache.org/

* ONApp
http://onapp.com/cdn/pricing/
http://cdn.onapp.com/files/datasheets/onapp_cdn_datasheet.pdf

Some Open Source to create CDN
http://www.fromdev.com/2011/06/create-cdn-content-delivery-network.html
http://labtel.ing.uniroma1.it/opencdn/
http://www.coralcdn.org/
http://cacheboy.net/
http://code.google.com/p/phloem/

Other Resources
http://serverfault.com/questions/244158/how-to-create-my-own-cdn-or-private-cloud
http://nixcraft.com/web-servers/17014-creating-own-cdn-using-nginx-possible.html

Limitations
* Performance that you get from a professional / Commercial CDN
* Smart DNS
* Edge points
* Caching server – squid or nginx

Zones – MaxCDN Control Panel


Hits: 3740  

A Content Delivery Network (CDN) enables site owner who demands a high performance, supremo visitor experience.

The MaxCDN Content Delivery Network efficiently delivers your site’s static files through hundreds of servers instead of slogging through a single host. This “smart route” technology distributes your content to your visitors via the city closest to them.

MaxCDN makes your site load faster… Much faster! Increased server capacity. Enhanced site….

Pull Zones

This Zone is for your every-day support files. A Pull Zone will automatically pull the data from a location that you specify upon the first request for the file. The files are served to the end user from either a subdomain of netdna-cdn.com or a custom domain (sub domain) of your choice that points to the CDN. The data is automatically purged from the server after an customizable amount of time.

Examples: Image Files, CSS Files, JavaScript Files

Push Zones

This Zone is built for larger files that rarely change. The data is uploaded to an account on our Storage Array which is then automagically pushed to all of our Edge Servers. The data is served to the end user from a domain (or sub domain) of your choice that points to the CDN. The files remain until modified or the zone is deleted.

Examples: Installers, E-Books, PDF’s

VOD Zones

This Zone is built for video and audio streaming. The data is uploaded to an account on our Storage Array which is then automagically pushed to all of our Edge Servers. The data is served from our specially modified WOWZA server using the RTMP (Real Time Media Protocol). The files remain until modified or the zone is deleted.

Examples: Flash, Windows Media, RealPlayer, Quicktime Files

Live Zones

This Zone is built specifically for live video or audio. The live content is received from a stream that is specified. The stream is then rebroadcast to the end users from a domain (or sub domain) of your choice that points to the CDN. The stream remains active until the zone is deleted.

Examples: Live webinar, Radio Station

AWS CloudFront with PHP


Hits: 8778  

Amazon CloudFront is a web service for content delivery (CDN). It integrates with other Amazon Web Services EC2 / S3 to give developers and businesses an easy way to distribute content to end users with low latency and high data transfer speeds.

http://aws.amazon.com/cloudfront/

Digital Inspiration – Thanks to http://www.labnol.org… it always provides help for all latest technologies 🙂

You can follow basic steps here to setup CloudFront with Amazon S3 with your domain…
How to Setup Amazon S3 with CloudFront as a Content Delivery Network

You can download Cloudfront keys from AWS account
https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key

<?php
 
error_reporting(E_ALL);

$file="svnlabs.flv"; // file on Amazon S3

function rsa_sha1_sign($policy, $private_key_filename) {
    $signature = "";

    // load the private key
    $fp = fopen($private_key_filename, "r");
    $priv_key = fread($fp, 8192);
    fclose($fp);
    $pkeyid = openssl_get_privatekey($priv_key);

    // compute signature
    openssl_sign($policy, $signature, $pkeyid);

    // free the key from memory
    openssl_free_key($pkeyid);

    return $signature;
}

function url_safe_base64_encode($value) {
    $encoded = base64_encode($value);
    // replace unsafe characters +, = and / with the safe characters -, _ and ~
    return str_replace(
        array('+', '=', '/'),
        array('-', '_', '~'),
        $encoded); 
}



function encode_query_params($stream_name) {

    return str_replace(
        array('?', '=', '&'),
        array('%3F', '%3D', '%26'),
        $stream_name);
}


/// Download from here... https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key

$private_key_filename = 'pk-XXXXXXXXXXXXXXXXXXXX.pem';
$key_pair_id = 'XXXXXXXXXXXXXXXXXXXX';
$cloudfront= 'http://svnlabs.cloudfront.net/';

$file_location = "$cloudfront$file";

$expires = time() + 3;  // 3 min from now
$remote_ip = $_SERVER['REMOTE_ADDR'];

$policy = 
'{'.
    '"Statement":['.
        '{'.
            '"Resource":"'. $file_location . '",'.
            '"Condition":{'.
                '"IpAddress":{"AWS:SourceIp":"' . $remote_ip . '/32"},'.
                '"DateLessThan":{"AWS:EpochTime":' . $expires . '}'.
            '}'.
        '}'.
    ']' .
'}';

$encoded_policy = url_safe_base64_encode($policy);
 
$signature = rsa_sha1_sign($policy, $private_key_filename);
 
$encoded_signature = url_safe_base64_encode($signature);
$streamer="?Policy=$encoded_policy&Signature=$encoded_signature&Key-Pair-Id=$key_pair_id" 

?>
<html>
<head>
<title>CloudFront Implementation in PHP</title> 
</head>
<body>
<a href='<?php echo "$file_location$streamer"; ?>'><?php echo "$file_location$streamer"; ?></a> 
</body> 
</html>

A Master inspires you by his being & learning happens. 😉