squid 反向加速模式下 本机apache的原IP log module – mod_extract_forwarded
squid 和 apache 如果跑在同一台机器上
squid 工作在反向加速模式(可基于单主机加速 或 代理+单主机加速)
apache Listen 127.0.0.1:80 (Port 80 BindAddress 127.0.0.1)
此时 apache log 的是 127.0.0.1
如果想在 apache 做 log 并记录原IP
就需要 mod_extract_forwarded
官方主页:
[web.warhound.org]
[web.warhound.org]
配置见
[web.warhound.org]
编译
apxs -c -o mod_extract_forwarded.so mod_extract_forwarded.c
cp -a mod_extract_forwarded.so /usr/lib/apache/
# add in /etc/httpd/conf/httpd.conf
LoadModule extract_forwarded_module modules/mod_extract_forwarded.so
AddModule mod_extract_forwarded.c
AllowForwarderCaching On
AddAcceptForwarder all
refresh_pattern 大概是 squid 最有意思但最不好懂的配置参数了,经过看书,大概明白如何使用,写出来贡献。
记住refresh_pattern 只对后端没设置Expires过期时间的页面起作用,比如论坛页面;而对类似apache mod_expires 设置过的页面不起作用。
说明之前,先将个概念LM,LM就是页面Header里时间(Date)和Last-Modified时间的差。Date一般是Squid从后面取页面的时间,Last-Modified 一般是页面生成时间。
refresh_pattern 的语法是
[code]
refresh_pattern [-i] regexp min percent max [options]
[/code]
regexp 就不讲了,大家都明白的;)
min, max的单位是分钟,percent就是百分比。
refresh_pattern 的算法如下:(当前时间定义为CURRENT_DATE)
1) If ((CURRENT_DATE-DATE(就是LM里定义的时间)) < min),cache是新鲜的
2) else if ((CURRENT_DATE-DATE) < (min + (max-min)*percent),cache是新鲜的
3) else cache是过期的
cache过期就需要从后面server取新鲜内容。
<img src="[url]http://blog.cnlinux.net/p_w_picpath/default/ad.gif[/url]">
如果希望页面一进入cache就不删除,直到被主动purge掉为止,可以加上ignore-reload选项
一般情况可以使用 reload-into-ims。
举例:
refresh_pattern -i \\.gif$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.jpg$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.png$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.mp3$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.wmv$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.rm$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.swf$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.mpeg$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.wma$ 1440 50% 2880 ignore-reload
refresh_pattern -i \\.css$ 10 50% 60 reload-into-ims
refresh_pattern -i \\.js$ 10 50% 60 reload-into-ims
refresh_pattern -i \\.xml$ 10 50% 30 reload-into-ims
很多时候,不希望所有用户可以ssh远程登录。例如对于ftp服务器,希望某些用户只能通过ftp登录。
在Redhat Linux下,可以将这些用户的shell设为 /bin/nologin,这样可以禁止用户登录。
但在Debian下,不存在/bin/nologin,可采用设置sshd配置文件来实现禁止特定用户远程登录的目的。在配置文件/etc/ssh/sshd_config中加入一行
AllowUsers root anotheruser
这样就只允许root和anotheruser通过ssh登录。
刚刚用超级终端远程登陆一台服务器的时候出现入下图这个提示:

原来是证书过期,2003默认采用证书管理,新安装的系统可以跟以前一样使用120天,证书120后过期,只能采用console方式来连接。
在运行那里执行:mstsc /v:192.168.1.1 /console