Serving Static Files

bernard.barbosa nginx-forum at nginx.us
Fri Sep 25 13:12:30 MSD 2009


Igor Sysoev Wrote:
-------------------------------------------------------
> On Fri, Sep 25, 2009 at 02:30:32AM -0400,
> bernard.barbosa wrote:
> 
> > Hi Igor,
> > 
> > Im sorry im a bit lost with the question and i
> have no idea which is the best. Is it by proxying
> or caching? I think  yes they can change in the
> future.. 
> > 
> > My setup should be something like this:
> > 
> > sample.server.com serve as the main or official
> site that users will access and the static files
> should be located at sample.static.com. How am i
> suppose to do it? both servers have nginx how
> should configure that?
> 
> sample.server.com:
> 
>    proxy_cache_path  /path/to/cache  levels=1:2 
> keys_zone=STATIC:10m
>                      inactive=1h;
> 
>    server {
> 
>        location /static/ {
>            proxy_pass            
> http://sample.static.com;
>            proxy_cache            STATIC;
>            proxy_cache_valid      1d;
>            proxy_cache_use_stale  error timeout
> invalid_header updating;
>        }
> 
> sample.static.com:
> 
>    server {
> 
>        location /static/ {
>            root  /path/to/files;
>        }
> 
> 
> -- 
> Igor Sysoev
> http://sysoev.ru/en/

Thanks Igor!! 
A few questions again :p
Should the two server must have identical files? i mean same directory and same files? 
How should i check that it works? 
Is there any documentation i can refer this to as well?

Thank you so much..
--
Bernard

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,2700,9156#msg-9156






More information about the nginx mailing list