Skip to content

Instantly share code, notes, and snippets.

@dtelaroli
Created September 27, 2018 15:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtelaroli/9ea4c52babdf4f3248ba5dc4c3f63504 to your computer and use it in GitHub Desktop.
Save dtelaroli/9ea4c52babdf4f3248ba5dc4c3f63504 to your computer and use it in GitHub Desktop.
Nginx php-fpm docker real origin ip
# you may use nginx with real ip module
server {
# your host or vpc cidr_block or the docker gateway address ip
set_real_ip_from 10.0.0.0/24;
real_ip_header X-Forwarded-For;
location ~ \.php$ {
# you should pass the header X-Forwarded-For with the real ip from frontend, the AWS ELB/ALB pass by default
fastcgi_param REMOTE_ADDR $http_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment