Welcome! Log In Create A New Profile

Advanced

Re: Caching servers in Local ISPs !!

June 16, 2014 01:20PM
Hello itpp,i have been abled to use ngx_http_geo_module. Now the request
coming from local ISP will first go to the main server (US) and then main
server will check if the ip is 1.2.3.4 so it'll direct the request to the
local caching server and than caching server will check if the file is
cached or it should again get the file from main server and cache it
locally.

When i tested it locally, it worked fine but the file URL in firebug is
coming from MAIN server when it should have come from the local caching
server. I can also see the caching directory size increases when the
matching client via geo module is directed to the local caching server but
the URL remains the same in firebug.

US config :-

geo $TW {
default 0;
192.168.1.0/24 1;
}



server {
listen 80;
server_name 002.files.com;
# limit_rate 600k;
location / {
root /var/www/html/files;
index index.html index.htm index.php;
# autoindex on;
}


location ~ \.(mp4|jpeg|jpg)$ {
mp4;
root /var/www/html/files;

if ($TW) {
proxy_pass http://192.168.22.32:80;
}

expires 7d;
valid_referers none blocked domain.com *.domain.com blog.domain.com
*.facebook.com *.twitter.com *.files.com *.pump.net domain.tv *.domain.tv
domainmedia.tv www.domainmedia.tv embed.domainmedia.tv;
if ($invalid_referer) {
return 403;
}
}
}

Edge config :-

proxy_ignore_headers "Set-Cookie";
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=static:100m
loader_threshold=300 loader_files=10 inactive=1d
max_size=300000m;


proxy_temp_path /data/nginx/tmp 1 2;
add_header X-Cache-Status $upstream_cache_status;
add_header Accept-Ranges bytes;
max_ranges 512;



server {

listen 80;
server_name 192.168.22.32;
root /var/www/html/files;
location ~ \.(mp4|jpeg|jpg)$ {
root /var/www/html/files;
mp4;
try_files $uri @getfrom_origin;

}


location @getfrom_origin {
proxy_pass http://002.files.com:80;
proxy_cache_valid 200 302 60m;
proxy_cache_valid any 1m;
proxy_cache static;
proxy_cache_min_uses 1;
}


Maybe i need to add some variable to get original server ip ?



http://nginx.org/en/docs/http/ngx_http_geo_module.html
http://nginx.org/en/docs/http/ngx_http_geo_module.html


On Fri, Jun 6, 2014 at 8:56 PM, shahzaib shahzaib <shahzaib.cb@gmail.com>
wrote:

> Thanks a lot itpp. :) I'll look into it and get back to you.
>
> Thanks again for quick solution :)
>
>
> On Fri, Jun 6, 2014 at 8:26 PM, itpp2012 <nginx-forum@nginx.us> wrote:
>
>> shahzaib1232 Wrote:
>> -------------------------------------------------------
>> > @itpp I am currenlty proceeding with proxy_cache method just because i
>> > had
>> > to done this in emergency mode due to boss pressure :-|. I have a
>> > quick
>> > question, can i make nginx to cache files for specific clients ?
>> >
>> > Like, if our caching servers are deployed by only single ISP named
>> > "ptcl".
>> > So if ip from ptcl client is browsing video, only his requested file
>> > should
>> > be cached not for any other client, does nginx support that ??
>>
>> You could do this based on some IP ranges or via
>> https://github.com/flant/nginx-http-rdns
>>
>> See
>>
>> http://serverfault.com/questions/380642/nginx-how-to-redirect-users-with-certain-ip-to-special-page
>> and
>>
>> http://www.cyberciti.biz/faq/nginx-redirect-backend-traffic-based-upon-client-ip-address/
>>
>> Posted at Nginx Forum:
>> http://forum.nginx.org/read.php?2,249997,250707#msg-250707
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Caching servers in Local ISPs !!

shahzaib1232 May 09, 2014 11:00AM

Re: Caching servers in Local ISPs !!

Rainer Duffner May 09, 2014 01:20PM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 09, 2014 01:46PM

Re: Caching servers in Local ISPs !!

itpp2012 May 09, 2014 02:49PM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 09, 2014 03:24PM

Re: Caching servers in Local ISPs !!

itpp2012 May 09, 2014 04:01PM

Re: Caching servers in Local ISPs !!

GreenGecko May 10, 2014 12:26AM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 10, 2014 05:20AM

Re: Caching servers in Local ISPs !!

itpp2012 May 10, 2014 06:39AM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 27, 2014 06:14AM

Re: Caching servers in Local ISPs !!

itpp2012 May 27, 2014 06:55AM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 27, 2014 08:18AM

Re: Caching servers in Local ISPs !!

itpp2012 May 27, 2014 09:00AM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 27, 2014 09:28AM

Re: Caching servers in Local ISPs !!

itpp2012 May 27, 2014 09:41AM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 28, 2014 04:48AM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 28, 2014 05:18AM

Re: Caching servers in Local ISPs !!

itpp2012 May 28, 2014 05:50AM

Re: Caching servers in Local ISPs !!

shahzaib1232 May 28, 2014 07:20AM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 04, 2014 02:52PM

Re: Caching servers in Local ISPs !!

itpp2012 June 04, 2014 03:19PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 04, 2014 03:24PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 06, 2014 09:38AM

Re: Caching servers in Local ISPs !!

itpp2012 June 06, 2014 11:26AM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 06, 2014 11:58AM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 16, 2014 01:20PM

Re: Caching servers in Local ISPs !!

itpp2012 June 16, 2014 01:41PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 17, 2014 10:00AM

Re: Caching servers in Local ISPs !!

itpp2012 June 17, 2014 01:11PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 17, 2014 02:10PM

Re: Caching servers in Local ISPs !!

itpp2012 June 17, 2014 02:32PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 17, 2014 02:48PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 17, 2014 02:48PM

Re: Caching servers in Local ISPs !!

itpp2012 June 17, 2014 03:50PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 18, 2014 01:12PM

Re: Caching servers in Local ISPs !!

itpp2012 June 18, 2014 02:24PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 18, 2014 02:32PM

RE: Caching servers in Local ISPs !!

Lukas Tribus June 18, 2014 03:36PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 18, 2014 03:46PM

Re: Caching servers in Local ISPs !!

Jonathan Matthews June 18, 2014 04:06PM

Re: Caching servers in Local ISPs !!

shahzaib1232 June 19, 2014 01:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 207
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready