Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Nginx Module Development - get user ip     - Android official recommendation: DialogFragment create dialog (Programming)

- gzip, bzip2, xz, tar, zip compression, archive Detailed (Linux)

- Git build a team development environment operating drills (Linux)

- Between the two to achieve the main MySQL database synchronization from (Database)

- PHP Performance Analysis and Experiment: Performance Micro Analysis (Programming)

- libnet list of functions (Programming)

- Eight sorting algorithm implemented in Python (Programming)

- How to run Kali Linux 2.0 in Docker container (Linux)

- The Objects in JavaScript (Programming)

- Getting case of Python Hello World (Programming)

- How to Upgrade Ubuntu GNOME 14.10 to GNOME 3.16 Desktop (Linux)

- Under CentOS 7 installation and deployment environment Ceph (Server)

- How to use the Linux terminal Git commands (Linux)

- Several Ceph performance optimization of new methods and ideas (2015 SH Ceph Day after flu reference) (Server)

- MySQL enabled SSD storage (Database)

- CentOS7 compile and install Tengine + PHP + MariaDB notes (Server)

- Using the Linux folder wc statistics number of lines of code for all files (including subdirectories) (Linux)

- CentOS 6.4 compiler installed MySQL 5.6.14 (Database)

- Ubuntu install Eclipse can not find JAVA_HOME problem (Linux)

- Struts2 form of non-use component tags (Programming)

  Nginx Module Development - get user ip
  Add Date : 2018-11-21      
  Nginx Module Development - get user ip

Core code:

if (r-> headers_in.x_real_ip! = NULL) {
         ngx_log_error (NGX_LOG_ERR, r-> connection-> log, 0, "% V", & r-> headers_in.x_real_ip-> value);
     } Else {
         sockaddr_in * sin = (sockaddr_in *) (r-> connection-> sockaddr);
         ngx_log_error (NGX_LOG_ERR, r-> connection-> log, 0, "% s", inet_ntoa (sin-> sin_addr));
Code testing so that

Code means: If Header has x-real-ip, it is treated as ip, ip otherwise get from the socket, there simply will be printed to the error log ip Lane

Where r is ngx_http_request_t pointer know nginx module to develop basic data structures will know this, if you do not know, please do understand separately

Tucao: I spent a morning time looking nginx module How to obtain ip, seemingly not much information on the Internet, just google a buddy said to go in the socket connection to get, a ready-made package nginx could not function?
- Linux five security TIPS (Linux)
- Java proxy mode (Programming)
- How to disable UEFI to install Linux on Win8 (Linux)
- To batch create users under Linux (Linux)
- CentOS5 installation Nodejs (Linux)
- How to add any of a Linux distribution beautiful fonts (Linux)
- Use IP address spoofing Intrusion Prevention Firewall (Linux)
- stat - Get more information than ls (Linux)
- Ubuntu 15.04 using the Eclipse 4.4, Java 8 and WTP (Linux)
- Linux, modify / retrieve the root password (Linux)
- TPCC-MySQL Benchmark (Database)
- View processes and threads under Linux (Linux)
- Specifies the open ports of the SUSE firewall settings (Linux)
- Ubuntu install Oracle 10g process and problem solution (Linux)
- Introduction to thread pooling and simple implementation (Programming)
- When Linux Detailed time zone and common function of time (Linux)
- Oracle utilized undo data recovery operations (Database)
- Use read command to read user input (Programming)
- Zabbix system email alert Python script (Server)
- MySQL root password reset under CentOS (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.