proxy server后的apache如何获取用户真实IP
本文代码在SuSE/Ubuntu下测试通过(包括32位和64位),如果看完本文解决不了你的问题,请用google搜素关键字:AddAcceptForwarder
用lighttpd做proxy server,来对多个apache做负载均衡已经是很常见的做法了。但是默认情况下,apache日志中获不到访问者的真实IP,对于分析日志带来一定困难,最简单的方法是使用mod_extract_forwarded2。
安装编译脚本如下(apxs2需要先安装apache2-devel):
mkdir mod_extract_forwarded2 cd mod_extract_forwarded2 wget http://www.codigg.com/wp-content/uploads/2009/09/mod_extract_forwarded2.c apxs2 -cia mod_extract_forwarded2.c |
如果apache是用系统的配置工具安装的(如SuSE下用yast) ,那么上述脚本可能会在/etc/sysconfig/apache2 的 APACHE_MODULES 中自动添加 extract_forwarded_module;如果没有自动添加,则需要在apache的配置文件中手工加载:
LoadModule extract_forwarded_module modules/mod_extract_forwarded2.so
最后在apache中配置:
AddAcceptForwarder “192.168.1.10″
其中192.168.1.10为代理服务器,即lighttpd服务器所在的IP。
最后重启服务器,此时在日志中用%h就能获取到访问用户的真实IP了。
原创文章如转载,请注明:转载自CODIGG [ http://www.codigg.com/ ]
本文链接地址:http://www.codigg.com/2009/09/proxy-server-real-ip-lighttpd-apache/


四月 20th, 2011 at 12:51
A5OJjw aaotszhppwiq, [url=http://wcvejkzsralu.com/]wcvejkzsralu[/url], [link=http://nidxvztrtrnm.com/]nidxvztrtrnm[/link], http://vtbfzeegsegj.com/
[回复]
六月 3rd, 2011 at 15:42
1082003 beers on the wall.
[回复]
六月 3rd, 2011 at 15:42
4675956 beers on the wall.
[回复]
一月 13th, 2012 at 00:38
After all uggs for kids and the Mini
[回复]
一月 13th, 2012 at 09:48
d httpd Look for this line httpd HTTPD usr sbin httpd Change to httpd HTTPD usr local apache2 bin httpd and this CONFFILE etc httpd conf httpd.
[回复]
一月 14th, 2012 at 13:06
Hello there, just became alert to your blog through Google, and found that it’s really informative. I’m gonna watch out for brussels. I will be grateful if you continue this in future. Many people will be benefited from your writing. Cheers!
[回复]
一月 19th, 2012 at 13:32
the feet could have sensed scorching and also not comfortable inside summer ugg boots outlet your charisma involving UGG variations can be perhaps richen which has a amazing color scheme
[回复]
一月 19th, 2012 at 15:20
although several earth splitting can ugg boots canada sale But we do detect their classy taste expressions on the second glimpse on these shoes
[回复]
一月 20th, 2012 at 04:48
chanel boots are usually a single photo of the very most well-known artist bags traces on earth, using a need carrier regarding traditions and also plastic rubber-stamped mettle.
[回复]
一月 20th, 2012 at 15:44
coach handbag snake brown
[回复]
一月 22nd, 2012 at 06:20
they will not likely look ridiculous out and about from the globe ugg outlet store some UGG planting season along with summertime will take anyone tremendous surprises along with delight
[回复]
一月 22nd, 2012 at 23:49
This article is fastidious and fruitful in support of all new PHP related web programmers; they have to read it and perform the practice.
[回复]
一月 25th, 2012 at 00:40
Written by the Utility Players, the troupe
[回复]
一月 26th, 2012 at 17:59
All of us were very happy to come across this site. . ! We wished to say thanks to you for the time and effort for this terrific article. . ! I undoubtedly appreciating virtually every little piece of it and, I have this content book marked to check out out latest stuff you post to your site.
[回复]
一月 30th, 2012 at 00:19
proxy serveråŽçš„apache如何获å–用户真实IP – CODIGG I was recommended this blog by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my trouble. You are incredible! Thanks! your article about proxy serveråŽçš„apache如何获å–用户真实IP – CODIGGBest Regards Cindy
[回复]
一月 30th, 2012 at 06:09
These people are available in multicolor through teal in order to lemon kids uggs tasman they have merely been in brand-new twelve months while men’s uggs emerged to get last but not least footed high on his or her income
[回复]
一月 30th, 2012 at 10:08
Elect to pay wither via your debit or bank card, or select any with the other chanel shoes options listed certainly, there.
[回复]
一月 30th, 2012 at 10:25
There is perceptibly a lot to identify about this. I think you made some good points in features also.
[回复]
一月 31st, 2012 at 22:44
usually are everywhere you go! Seems like you should not go because of the windows present connected with almost any outfits or maybe running shoe retail store devoid of finding from it a couple most of these modern shoes ugg boots on sale which add a flair flavor to the look
[回复]
二月 3rd, 2012 at 00:54
You made several good points there. I did a search on the issue and found a good number of people will go along with with your blog.
[回复]
二月 3rd, 2012 at 01:03
proxy serveråŽçš„apache如何获å–用户真实IP – CODIGG I was suggested this web site by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my difficulty. You’re wonderful! Thanks! your article about proxy serveråŽçš„apache如何获å–用户真实IP – CODIGGBest Regards Cindy
[回复]
二月 3rd, 2012 at 02:36
My favorite city out of all of them, no doubt about it that its Zurich Switz. Switzerland connects you with nature so much. Something I absolutely love, it is calm and relaxing.
[回复]
二月 3rd, 2012 at 03:13
I am so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that’s at the other blogs. Appreciate your sharing this greatest doc.
[回复]
二月 3rd, 2012 at 18:06
The appear of the vibrant coloured traditional brief having a thin jean classic ugg shoes for men The sheepskin UGG keep your feet warm in winter and cool during the summer
[回复]
二月 4th, 2012 at 16:16
UGG shorts boots are here to stay ugg boots From ugg classic cardy to ugg 5498 adirondack tall boots
[回复]