Variable dobts:- Do I need to hard code values ($host, $rmote_addr , $proxy_add_x_forwarded)

John Joseph jjk_saji at yahoo.com
Mon Nov 29 16:01:41 MSK 2010


Hi 
  I am trying to configure nginx for reverse proxy,my intention is to have load balancing, On 192.168.20.59(CentOS) I have nginx installed. I have two machines(192.168.20.59 and 192.168.20.208) running IIS. 

My Test environment is as shown in the map 


       |
 =============                              |---- rac1.mydomain.com
| LAN        |                              |       192.168.20.59
 =============                              |---- rac2.mydomain.com 
       |                                    |      192.168.20.208
       |                                    |
       |      |eth0 -> 192.168.20.34 ------/
       |-lb0==|                           /
       |      |eth1 -> 192.168.20.44 ----/
       |      | eth1=virtual IP address 
       |
       |
=================                              
|LAN Connection |                              
=================          

I am referening book "Nginx HTTP server ", Chapter 7 + other related  google search results. I have doubt in the variable setting, do we need to hard code the value of does the program take it from any other parameters. 
My doubts are how I am getting values for $host, $rmote_addr , $proxy_add_x_forwarded_for(part of configuration files I have cut and pasted); Do I need to give the real IP address itself instead of the varibales ($host, $rmote_addr , $proxy_add_x_forwarded) in the configuration file

 ## PROXY - Web
      location / {
        proxy_pass  http://127.0.0.1:80;
        #proxy_pass  http://192.168.20.34:80;
        proxy_cache            cache;
        proxy_cache_valid      200 24h;
        proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;
        proxy_ignore_headers   Expires Cache-Control;

        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      }
##############
Please advice me 
Thanks
  Joseph John 








More information about the nginx mailing list