Nginx 如何处理 HTTP 请求

1.非常重要的结论:server_name对应的是http请求头里的Host字段的值

curl.exe -H "Host: aaa" 10.210.65.73

参考:https://www.cnblogs.com/xiaoshiwang/p/11436332.html

 --------------------------------------------------

proxy_set_header Host $host:$server_port;  这段比较关键之前我没加$server_port就老是到下级请求出现真实端口号

参考:https://www.cnblogs.com/z-books/p/12410979.html

2.获取远程的ip

proxy_set_header        X-Real-IP $remote_addr;  #获取真实ip

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;#获取代理者的真实ip
参考:https://www.cnblogs.com/hanmk/p/9290533.html
原文地址:https://www.cnblogs.com/hixiaowei/p/13832609.html