Welcome! Log In Create A New Profile

Advanced

Re: Serving Static Files

September 25, 2009 05:30AM
On Fri, Sep 25, 2009 at 05:12:30AM -0400, bernard.barbosa wrote:

> 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?

Try to keep configuration as simple as possible to avoid any issues in future.
This means that file names should be identical.

You can use some directory mapping as

location /static/ {
proxy_pass http://sample.static.com/another/dir/;
}

or

location /static/ {
alias /path/to/some/files/;
}

but I prefere direct mapping.

> How should i check that it works?

Using logs.

> Is there any documentation i can refer this to as well?

http://wiki.nginx.org/NginxHttpProxyModule


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Serving Static Files

vanderkerkoff June 08, 2009 05:32AM

Re: Serving Static Files

bernard.barbosa September 24, 2009 03:43AM

Re: Serving Static Files

Igor Sysoev September 24, 2009 06:12AM

Re: Serving Static Files

bernard.barbosa September 25, 2009 02:30AM

Re: Serving Static Files

Igor Sysoev September 25, 2009 04:58AM

Re: Serving Static Files

bernard.barbosa September 25, 2009 05:12AM

Re: Serving Static Files

bernard.barbosa September 25, 2009 05:19AM

Re: Serving Static Files

Igor Sysoev September 25, 2009 05:30AM

Re: Serving Static Files

Igor Sysoev September 25, 2009 05:34AM

Re: Serving Static Files

bernard.barbosa September 27, 2009 11:52PM

Re: Serving Static Files

bernard.barbosa September 27, 2009 11:54PM

Re: Serving Static Files

bernard.barbosa September 29, 2009 05:11AM

Re: Serving Static Files

bernard.barbosa October 04, 2009 11:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready