From 1c6361c245326ee7924da1ea1d6982407a91b10e Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Thu, 14 Mar 2024 12:27:09 -0400 Subject: [PATCH] have docker nginx logs print the client IP --- crayfish/rootfs/etc/nginx/http.d/default.conf | 4 ++++ drupal/rootfs/etc/nginx/http.d/default.conf | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/crayfish/rootfs/etc/nginx/http.d/default.conf b/crayfish/rootfs/etc/nginx/http.d/default.conf index c59416d3..89d44c90 100644 --- a/crayfish/rootfs/etc/nginx/http.d/default.conf +++ b/crayfish/rootfs/etc/nginx/http.d/default.conf @@ -3,6 +3,10 @@ server { listen 8000; root /var/www/html; + # have docker logs show the client IP + real_ip_header X-Forwarded-For; + set_real_ip_from 172.0.0.0/8; + location / { # try to serve file directly, fallback to index.php try_files $uri /index.php$is_args$args; diff --git a/drupal/rootfs/etc/nginx/http.d/default.conf b/drupal/rootfs/etc/nginx/http.d/default.conf index fad70f8e..bcb8a4ca 100644 --- a/drupal/rootfs/etc/nginx/http.d/default.conf +++ b/drupal/rootfs/etc/nginx/http.d/default.conf @@ -2,6 +2,10 @@ server { server_name drupal; + # have docker logs show the client IP + real_ip_header X-Forwarded-For; + set_real_ip_from 172.0.0.0/8; + include /etc/nginx/shared/drupal.defaults.conf; include /etc/nginx/shared/drupal.fpm.conf; # Required for Nginx service to validate that fpm is working.