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

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

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

My Test environment is as shown in the map 

 =============                              |----
| LAN        |                              |
 =============                              |---- 
       |                                    |
       |                                    |
       |      |eth0 -> ------/
       |-lb0==|                           /
       |      |eth1 -> ----/
       |      | 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_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 
  Joseph John 

More information about the nginx mailing list