upstream host name or address

torajx nginx-forum at nginx.us
Mon Jun 20 08:57:09 MSD 2011


hi again and thank you fo reply
this is my main config file; sorry i remove real ip address and site
names

  upstream mysites {
       server 192.168.1.1 weight=5;
#       server 192.168.1.2 weight=3;
  }
  upstream mysites_hash {
       ip_hash; #base on clinet ip address and can not use weight;
       server 192.168.1.1;
#       server 192.168.1.2;
  }
  upstream myimages {
       server images.mysite.com;
  }
  server {
       listen    80;
       server_name   nx.chare.ir;
       set $tmp tempstr;
       access_log var/log/nx_csupdate_access.log main;
       log_format  main  "$upstream_addr";

       location /  {
             deny all;
       }
       location /csupdate/images {
             proxy_pass      http://myimages;
       }
       location /csupdate {
          proxy_pass      http://mysites_hash;
          proxy_set_header Host    192.168.1.1;
       }


as you can see i commented my 2th server in my upstream; 
the proxy_set_header line in location /csupdate was the only soloution
that solved
my problem; because my servers (192.168.1.1, 2) will redirect users base
on some condition
and without proxy_set_header line the browsers fall in endless loop and
retun errors;

for $upstream_addr in can see 192.168.1.1:80 in my log files as i
formated simply likme above;
but what is soloution in i want to use 192.168.1.2 server too ??

thank you in advance

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,208188,208379#msg-208379




More information about the nginx mailing list