first I install the lnmp environment using a container in docker,docker under Mac. When the user accesses, when the project gets the visitor Ip, the ip, bridged by the docker such as 172.0.0.1 will never get the client ip. Google has been unable to solve the problem for a long time. Solve
and also want to go to the ip of the host. Thank you
here is the NGINX configuration
listen 80;
server_name www.nihao.test;
location / {
proxy_pass http://www.nihao.test;
proxy_set_header Host $host:$server_port;-sharp
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header HTTP_X_FORWARDED_FOR $remote_addr;-sharp
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect default;
try_files $uri $uri/ $uri=404;
}