Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
  • Hardware
  • Programming
    • Graphic
    • HTML / PHP / CMS
      • AJAX
      • Apache
      • CSS
      • Drupal
      • Flash video
      • HTML examples
      • PHP
      • WebDAV
      • Webserver UTF-8 encoding
      • framebreaker
      • nginx
        • Log client ip
        • Nginx access control / GeoIP
        • linux, nginx, webserver
    • Java
    • PL / SQL
    • Magento
    • python
    • Asterisk
    • C / C++
    • JavaScript
    • Json
    • Magento
    • OpenOffice / LibreOffice
    • Perl
    • Postfix
    • Regular Expression
    • TLA
    • Tomcat
    • Zenity
    • bash
    • find
    • git
    • ofbiz
    • wildfly
    • xml
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid
  • nginx

Use nginx real_ip module

nginx -V | grep with-http_realip_module

# /etc/nginx/nginx.conf
...
http {
    ...
    # set_real_ip_from 0.0.0.0/0;
    set_real_ip_from x.x.x.x/x; # LB subnet
    real_ip_header X-Forwarded-For;
    ...
}
...

Option 2: customize log_format

cat /etc/nginx/nginx.conf
...
log_format  main  '$http_x_forwarded_for - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log main;
...

Reload Nginx configuration

service nginx reload

Links
http://www.loadbalancer.org/blog/nginx-and-x-forwarded-for-header/
https://serverfault.com/questions/729128/overriding-nginx-access-log-directive-duplicate-log-entries
http://nginx.org/en/docs/http/ngx_http_log_module.html
https://www.nginx.com/resources/wiki/start/topics/examples/full/

Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung