Welcome! Log In Create A New Profile

Advanced

Re: nginx serving wrong website under proxy_cache

All files from this thread

File Name File Size   Posted by Date  
error.txt 83.5 KB open | download Jim Ohlstein 05/03/2009 Read message
patch.fastcgi_cache 535 bytes open | download Igor Sysoev 05/04/2009 Read message
May 02, 2009 11:12PM
Igor Sysoev Wrote:
-------------------------------------------------------
> On Tue, Apr 28, 2009 at 11:40:03PM -0700, Payam
> Chychi wrote:
>
> > 2009/4/28 Igor Sysoev :
> > > On Tue, Apr 28, 2009 at 07:27:00PM -0700,
> Payam Chychi wrote:
> > >
> > >> hey guys,
> > >>
> > >> So I had 3 sites configured to use caching on
> my nginx box (tried with
> > >> .50, 52 and 53 build) however of the three
> websites kept redirecting
> > >> me to the first site that I was doing caching
> for.
> > >>
> > >> Example Sites:
> > >> 0.0.0.1
> > >> 0.0.0.2
> > >> 0.0.0.3
> > >>
> > >> HTTP config very similar to this only each
> utilize a different
> > >> "listen" ip address and each site has a
> different Backend 'Origin" ip:
> > >>
> > >> # HTTP LB
> > >> upstream LB_HTTP_0.0.0.1 {
> > >> server x.x.x.x:80;
> > >> }
> > >>
> > >> server {
> > >>
> > >> listen 0.0.0.1:80;
> > >> server_name website_0.0.0.1;
> > >>
> > >> access_log
> /var/log/nginx/any.website_0.0.0.1.access_log
> main;
> > >> error_log
> /var/log/nginx/any.website_0.0.0.1.error_log
> info;
> > >>
> > >> error_page 404 /404.html;
> > >> location = /404.html {
> > >> root html;
> > >> }
> > >> error_page 404 500 502 503 504
> /50x.html;
> > >> location = /50x.html {
> > >> root html;
> > >> }
> > >>
> > >> location / {
> > >> proxy_intercept_errors on;
> > >> proxy_pass
> http://LB_HTTP_0.0.0.1;
> > >> proxy_cache one;
> > >> proxy_cache_key
> backend$request_uri;
> > >
> > > Do you have the same
> > >
> > > proxy_cache_key
> backend$request_uri;
> > >
> > > for all three sites ? You need something like
> this:
> > >
> > > proxy_cache_key
> 0.0.0.1$request_uri;
> > >
> > > Or you may create several caches:
> > >
> > > proxy_path /path/to/cache1
> keys_zone=cache1:10m;
> > >
> > >> proxy_cache_valid 200 1h;
> > >> proxy_cache_valid 404 5m;
> > >> proxy_cache_use_stale error
> timeout invalid_header;
> > >> }
> > >> }
> > >>
> > >>
> > >> When browsing to 0.0.0.1, everything was
> fine
> > >> going to 0.0.0.2 or 0.0.0.3 or any other ip
> for that matter in the
> > >> same class C "/24" it would redirect you to
> the 0.0.0.1 config which
> > >> would then proxy-pass the data back to the
> origin belonging to the
> > >> 0.0.0.1 config
> > >>
> > >> Anyone seen this issue at all?
> > >> Once i commented all proxy_cache and
> restarted nginx, problem went away.
> > >>
> > >> Note that i even tried deleting
> /etc/nginx-cache/* and recreating
> > >> it... did not help
> > >>
> > >> Thanks,
> > >> --
> > >> Payam Tarverdyan Chychi
> > >> Network Security Specialist / Network
> Engineer
> > >
> > > --
> > > Igor Sysoev
> > > http://sysoev.ru/en/
> > >
> > >
> >
> > Hey Igor,
> >
> > That was the problem... I was using "backend"
> for each of the configs
> > so it was confused. Which would you recommend
> for stability and
> > scalability, attaching a dynamic $ to the
> proxy_cache_key or creating
> > a separate cache for each site that requires
> caching?
> > keep in mind that id like to support up to 500
> sites per box if
> > possible, each doing anywhere from 1mbps to
> +10mbps
>
> Unique proxy_cache_key is enough. The different
> proxy_cache_path's are
> required just for simple addministration, say,
> max_size, inactivity, etc.
>
>

I assume the same configuration rules also apply to fastcgi_proxy.

Do I need to use two fastcgi_proxy_key settings if a site serves both http and https?

> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>

--
Jim Ohlstein
Subject Author Posted

nginx serving wrong website under proxy_cache

Payam Chychi April 28, 2009 10:27PM

Re: nginx serving wrong website under proxy_cache

Payam Chychi April 28, 2009 10:55PM

Re: nginx serving wrong website under proxy_cache

Igor Sysoev April 29, 2009 01:49AM

Re: nginx serving wrong website under proxy_cache

Payam Chychi April 29, 2009 02:40AM

Re: nginx serving wrong website under proxy_cache

Igor Sysoev April 29, 2009 02:44AM

Re: nginx serving wrong website under proxy_cache

Jim Ohlstein May 02, 2009 11:12PM

Re: nginx serving wrong website under proxy_cache

Jim Ohlstein May 02, 2009 11:16PM

Re: nginx serving wrong website under proxy_cache

Igor Sysoev May 03, 2009 12:34AM

Re: nginx serving wrong website under proxy_cache

Jim Ohlstein May 03, 2009 01:18AM

Re: nginx serving wrong website under proxy_cache

Igor Sysoev May 03, 2009 01:29AM

Re: nginx serving wrong website under proxy_cache

Jim Ohlstein May 03, 2009 02:05AM

Re: nginx serving wrong website under proxy_cache

Igor Sysoev May 03, 2009 02:44AM

Re: nginx serving wrong website under proxy_cache

Jim Ohlstein May 03, 2009 03:15AM

Re: nginx serving wrong website under proxy_cache

Igor Sysoev May 03, 2009 03:28AM

Re: nginx serving wrong website under proxy_cache Attachments

Jim Ohlstein May 03, 2009 03:55PM

Re: nginx serving wrong website under proxy_cache

Payam Chychi May 03, 2009 04:21PM

Re: nginx serving wrong website under proxy_cache Attachments

Igor Sysoev May 04, 2009 02:46PM

Re: nginx serving wrong website under proxy_cache

alamgir99 May 04, 2009 11:45AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 259
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready