reverse proxy - several virtual host - same proxy pass ip - getting wrong content

Payam Chychi pchychi at gmail.com
Wed Mar 24 13:42:48 MSK 2010


you need to set a cache key based on the hostname (or something  
dynamic) else you will serve caches content as (index.HTML) from site1  
for site2 and site3... index requests

Regards,
--
Payam Tarverdyan Chychi
Network Engineer

Sent from my iPhone

On 2010-03-24, at 2:34 AM, Pekka.Panula at sofor.fi wrote:

> Hi
>
> I am using nginx as reverse proxy and i have several names pointing  
> to reverse proxy and i am using proxy cache. My backends are basic  
> LAMP servers and IBM Lotus Domino servers.
>
> Just wondering whats wrong as i changed domain to point my new nginx  
> server and i am getting wrong content, i am getting wrong virtual  
> host index page.
>
> eg. i am trying to http://www.silverice.org/ and i am getting  
> content from http://www.etappi.com/ they reside same LAMP-server.  
> Looking my nginx configuration i cant find anything wrong.
> both named points to new nginx reverse proxy server. nginx version  
> 0.7.65
>
> Here is example from my config:
>
> my main config, main parts:
> ------------8<--------------------------------
> http {
>     proxy_cache_path  /usr/share/nginx/cache  levels=1:2    
> keys_zone=one:10m max_size=1G;
>     proxy_temp_path   /usr/share/nginx/tmp;
>
>     proxy_cache_valid 200 302 5m;
>     proxy_cache_valid 301 1h;
>     proxy_cache_valid any 1m;
>
>      proxy_cache one;
>
>    gzip_http_version 1.1;
>    gzip_vary          on;
>    gzip_min_length  1100;
>    gzip_buffers     16 8k;
>    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
>    gzip_proxied     any;
>    gzip_types       text/css text/plain application/atom+xml  
> application/x-javascript application/xml text/javascript application/ 
> xml+rss;
>    gzip on;
>
>    server_tokens off;
>    client_header_timeout  3m;
>    send_timeout           3m;
>    client_header_buffer_size    1k;
>    large_client_header_buffers  4 4k;
>    output_buffers   1 32k;
>    postpone_output  1460;
>    sendfile         on;
>    tcp_nopush       on;
>    tcp_nodelay      on;
>    keepalive_timeout  75 20;
>    server_names_hash_bucket_size 128; # this seems to be required  
> for some vh
>
>    log_format  main  '$remote_addr - $remote_user [$time_local]  
> $request '
>                      '"$status" $body_bytes_sent "$http_referer" '
>                      '"$http_user_agent" "$http_x_forwarded_for"';
>
>    proxy_redirect        off;
>    proxy_set_header      Host             $host;
>    proxy_set_header      X-Real-IP        $remote_addr;
>    proxy_set_header      X-Forwarded-For  $proxy_add_x_forwarded_for;
>    proxy_connect_timeout 90;
>    proxy_send_timeout    90;
>    proxy_read_timeout    90;
>
>    # default virtual host
>     server {
>         listen          80 default;
>         server_name     _;
>
>         access_log  /var/log/nginx/default-access.log  main;
>
>         server_name_in_redirect  off;
>
>         location / {
>             index index.html;
>             root  /var/www/default/htdocs;
>         }
>    }
>
>    # here resides my virtual host configurations
>    include /etc/nginx/virtual-hosts/*;
>
> }
>
> and my virtual hosts under: /etc/nginx/virtual-hosts -directory:
>
> they all look like this:
> www.silverice.org:
> --------------------------8<----------------
> # redirect silverice.org -> www.silverice.org
> server {
>    server_name silverice.org;
>    rewrite     ^/(.*)$ http://www.silverice.org/$1 permanent;
> }
>
> server {
>    server_name  www.silverice.org;
>    access_log   /somedirectory/www.silverice.org/www.silverice.org- 
> access_log combined;
>    default_type text/html;
>    root         /usr/share/nginx/huolto;
>
>    location / {
>
>       proxy_pass http://ip.add.re.ss;
>
>       # manual maintenance window
>       include /etc/nginx/maintenance.conf;
>    }
>
>    # custom errorpages
>    include /etc/nginx/errorpages.conf;
>
>    # general block rules, security rules, etc
>    include /etc/nginx/suojaus.conf;
> }
> -----------------------------8<------------------
> And other virtual host like www.etappi.com looks like that, except  
> name and access log changed.
>
> How come when trying to load www.silverice.org i am getting www.etappi.com 
>  content, mainly index page comes from wrong site.
>
> Looking backend logs i cant find error there, nothing has changed  
> there, name based virtual host there, Apache v2.
>
> Terveisin/Regards,
>   Pekka Panula, Sofor Oy - Jatkuvat palvelut
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100324/6759e835/attachment-0001.html>


More information about the nginx mailing list