dnmp
dnmp copied to clipboard
如何获取客户端真实 IP?
REMOTE_ADDR 恒为 172.18.0.1
系统 MacOS 12.1
➜ ~ docker --version
Docker version 20.10.12, build e91ed57
➜ ~ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
docker-composer.yaml
version: "3"
services:
nginx:
build:
context: ./services/nginx
args:
NGINX_VERSION: nginx:${NGINX_VERSION}
CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
NGINX_INSTALL_APPS: ${NGINX_INSTALL_APPS}
container_name: nginx
ports:
- mode: host
protocol: tcp
published: ${NGINX_HTTP_HOST_PORT}
target: 80
- mode: host
protocol: tcp
published: ${NGINX_HTTPS_HOST_PORT}
target: 443