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
Payam Chychi
April 29, 2009 02:40AM
2009/4/28 Igor Sysoev <is@rambler-co.ru>:
> 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

Thanks,
--
Payam Tarverdyan Chychi
Network Security Specialist / Network Engineer

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: 315
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