Serving Static Files

Igor Sysoev is at rambler-co.ru
Fri Sep 25 12:52:23 MSD 2009


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/





More information about the nginx mailing list