文章目录
1.获取真实的客户端ip
在此实验中server1作为nginx服务器;server2为server1的代理;server3为客户端
step1 在server2中修改nginx配置文件配置反向代理:
vim /usr/local/nginx/conf/nginx.conf
17 http {
18 include mime.types;
19 default_type application/octet-stream;
20 upstream westos {
21 server 172.25.254.1:80;
22 }
118 server {
119 listen 80;
120 server_name www.westos.org;
121 location / {
122 #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
123 proxy_pass http://westos;
124 }
125 }
nginx -t #语法检测
nginx -s reload #在不暂停服务的情况下重新加载