Nginx can't get client IP, it only return my gateway IP

Viewed 10

My website is running by LAMP and proxy by nginx, I want only allow intranet IP, so I have set the below restrictions.

allow 172.16.0.0/16; deny all;

it doesn't work, then I found all incoming IPs only show my gateway IP(172.16.0.254) in the logs like this

172.16.0.254 - - [11/Sep/2022:23:35:44 +0800] "GET /index.php HTTP/1.1" 200 4768..................

How can I get the real client IP, not my gateway IP?

0 Answers
Related