Nginx Proxy Module

Source: Internet
Author: User

Environment:

user:192.168.100.169

Nginx Agent: 192.168.100.175

tomcat:192.168.100.175

Domain Name: www.vijay.com--->192.168.100.175

1.nginx Configuration

    Server {        a;        server_name www.vijay.com;                      / {            proxy_pass http://192.168.100.175:8080/;             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;        }         /Status {                stub_status on;                 Access_log on;        }    }

2.web server-side log configuration (such as Tomcat)

 <valve classname=  Org.apache.catalina.valves.AccessLogValve   Directory= " logs  "   = localhost_access_log suffix="  .txt   "  ="  %h %{x-forwarded-for}i%{x-real-ip}i%{host}i %l%u%t &quot;%r&quot; %s%b  /> 
3.log log:
192.168.100.175  192.168.100.169 192.168.100.169Www.vijay.com--[ One/may/ .: -: +: -+0800]"get/bg-upper.png http/1.0" 304-192.168.100.175  192.168.100.169 192.168.100.169Www.vijay.com--[ One/may/ .: -: +: -+0800]"get/bg-nav.png http/1.0" 304-192.168.100.175  192.168.100.169 192.168.100.169Www.vijay.com--[ One/may/ .: -: +: -+0800]"get/asf-logo.png http/1.0" 304-192.168.100.175  192.168.100.169 192.168.100.169Www.vijay.com--[ One/may/ .: -: +: -+0800]"get/bg-button.png http/1.0" 304-192.168.100.175  192.168.100.169 192.168.100.169Www.vijay.com--[ One/may/ .: -: +: -+0800]"get/tomcat.png http/1.0" 304-192.168.100.175  192.168.100.169 192.168.100.169Www.vijay.com--[ One/may/ .: -: +: -+0800]"get/bg-middle.png http/1.0" 304-
%h:192.168.100.175
%{x-forwarded-for}i:192.168.100.169
%{x-real-ip}i:192.168.100.169
%{host}i:www.vijay.com

Note:


In general, X-forwarded-for is used to record agent information, each through a level of agent (except anonymous proxy), the proxy server will be the source IP of the request is appended in X-forwarded-for from 4. 4.4 1.1. 1.1 2.2. 2.2 3.3. 3.3 represents the request by 1. 1.1. 1 issued, after three layers of agent, the first layer is 2. 2.2. 2, the second floor is 3. 3.3. 3, and the source of this request is IP4. 4.4
1.1. 1.1 So, if there is only one layer of proxy, the value of these two headers is the same.

Nginx Proxy Module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.