Simple CDN service module made with PHP
I used Cloudflare to reduce the traffic load, but the connection location was LAX (Los Angeles), so I made it to be used to use it as a CDN form. The server is located in VULTR. The principle is that kilho.net/ {file} is connected to cdn.kilho.net/ {file} to disperse the traffic of the main hosting.[PHP] <? $cfg['url'] = 'kilho.net'; $cfg['cache'] = '../data/cache'; $url = $_SERVER['REQUEST_SCHEME'].'://'.$cfg['url'].$_SERVER['REQUEST_URI']; $url_arr = parse_url($url); switch($_SERVER['REQUEST_METHOD']) { case 'GET': $filename = $cfg['cache'].$url_arr['path']; $dirname = dirname($filename); if(!is_file($filename)) { if(!is_dir($dirname)) mkdir($dirname, 0707, true); $ch = curl_init(); $fp =...