Nginx replace REMOTE_ADDR with X-Forwarded-For

后端 未结 4 2017
逝去的感伤
逝去的感伤 2020-12-15 04:57

I am quite new to Nginx, and it seems all so confusing. I have my server setup perfectly, but the problem is, since my server is protected using a HTTP proxy; instead of log

4条回答
  •  盖世英雄少女心
    2020-12-15 05:47

    I solved my own problem, since PHP gets filtered through FastCGI, I simply added a fast CGI param which set REMOTE_ADDR to the variable http_x_forwarded_for, so something similar to this:

    fastcgi_param REMOTE_ADDR $http_x_forwarded_for;
    

提交回复
热议问题