简体   繁体   English

Apache访问日志显示2个IP

[英]Apache access log shows 2 IPs

I have a website and i was looking at the apache access log and its something like: 我有一个网站,我在查看apache访问日志及其类似信息:

www.my-website.com:80 10.xx.xx.xxx 24.114.xx.xxx - - [25/Aug/2014:23:59:51 +0000] 0 "GET / HTTP/1.1" 200 8915 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/xxx7 Safari/9537.53" www.my-website.com:80 10.xx.xx.xxx 24.114.xx.xxx --[2014年8月25日:23:59:51 +0000] 0“ GET / HTTP / 1.1” 200 8915“- “” Mozilla / 5.0(iPhone; CPU iPhone OS 7_1_2,如Mac OS X)AppleWebKit / 537.51.2(KHTML,如Gecko)版本/7.0 Mobile / xxx7 Safari / 9537.53“

As you can see it shows two ips, I checked the 2nd IP is my device's public IP from which I am accessing the website. 如您所见,它显示了两个IP,我检查了第二个IP是我正在访问网站的设备的公共IP。 What is the first IP for? 第一个IP有什么用?

When I try to get the IP of client accessing the site using PHP function calls like $ip = getenv('REMOTE_ADDR'); 当我尝试使用$ip = getenv('REMOTE_ADDR');等PHP函数调用来获取访问站点的客户端的IP时$ip = getenv('REMOTE_ADDR'); it always shows me the 1st IP. 它总是向我显示第一IP。

What is the 1st IP? 什么是第一IP? Please help me understand this. 请帮助我理解这一点。

Take a look at the full Apache config for your site, and see what it's using for its LogFormat directive. 查看您站点的完整Apache配置,并查看其LogFormat指令使用了什么。 It will either be a nickname for a common format, or a customized format which will list the fields that are included in the log. 它可以是通用格式的昵称,也可以是将列出日志中包含的字段的自定义格式的自定义格式。

Custom formats: http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats 自定义格式: http : //httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM