Entries Tagged as 'Open Source'

页面断了网都还能访问,而且能“刷新”

今天一人跟我讲起hao123的页面

说就是快

而且只要访问过一次,断了网再访问都还能访问

按“F5”、Ctrl+F5刷新都没问题

我看了一下

好像还真是

我就仔细看了一下

然后自己做了个测试

发现其实这个跟开始自己的想法一样

这没什么诀窍

就是过期时间设长一点

hao123好象是设的半个月

但我做测试的时候发现如果有gzip压缩的话好像不行

只要把gzip压缩关掉

就ok了

openvpn的客户端配置

我的客户端是一台openvpn client

配置文件如下:

[@41.108 ~]# cat /etc/openvpn/client.conf  

client

dev tun

proto udp

remote 192.168.13.15 1194

nobind

user nobody

group nobody

persist-key

persist-tun

ca ca.crt

cert client.crt

key client.key

tls-auth ta.key 1

ns-cert-type server

comp-lzo

verb 3

mute 20

我用openvpn搭的vpn server的配置文件:openvpn.conf

者是跑在一台freebsd上面的openvpn server

bash-2.05b# cat /usr/local/etc/openvpn/openvpn.conf           

local 192.168.13.15

port 1194

proto udp

dev tun

ca ca.crt

cert server.crt

key server.key

crl-verify vpncrl.pem

dh dh1024.pem

server 172.16.13.0 255.255.255.0

ifconfig-pool-persist ipp.txt

push "redirect-gateway"

keepalive 10 120

tls-auth ta.key 0

comp-lzo

max-clients 10

user nobody

group nobody

persist-key

persist-tun

status openvpn-status.log

log         openvpn.log

log-append  openvpn.log

verb 3

mute 20

apache2.2 released

http://httpd.apache.org/docs/2.2/new_features_2_2.html

相对于以前的版本

2.2的配置文件更结构清晰了

因为他把原来一个配置文件httpd.conf

变成了分功能的conf.d/*.conf

不过需要在httpd.conf中把相应的注释去掉才行

而且

从2.2的版本还是

缺省打开了大文件支持

这样再碰上大于2G的文件的时候

系统也不会有问题

proftpd配置虚用户

配了个proftpd

不想用系统帐号

也不想用数据库

反正用户书也不多

就直接用文件

于是

authuserfile

authgroupfile

分别指向了认证的用户文件和用户组文件

authuserfile里的信息可以由proftpd带的一个叫ftpasswd的perl脚本程序实现

ftpasswd –passwd –file=/pathtoproftpd/etc/proftpd.user –name=username –uid=1001 –home=/www/www.domainname.com –shell=/bin/false

ftpasswd是一个很好用的工具

在proftpd源代码目录下的crontab目录下

这里的一个文档

用源代码编mysql的时候”fails sanity check”的错误

linux2.6的kernel(RedHat enterprise AS 4)

编译mysql4.1.11的时候

./configure

结果出错:

configure: error: C++ preprocessor "/lib/cpp" fails sanity check

ls -l /lib/cpp

这个文件又存在

后来仔细检查

才发现是系统少装了一个包:gcc-c++

apt-get install gcc-c++

则问题解决

squid和raid

在squid的官方的faq上有这么一段话:

3.11 Is it okay to use separate drives and RAID on Squid?
RAID1 is fine, and so are separate drives.

RAID0 (striping) with Squid only gives you the drawback that if you lose one of the drives the whole stripe set is lost. There is no benefit in performance as Squid already distributes the load on the drives quite nicely.

Squid is the worst case application for RAID5, whether hardware or software, and will absolutely kill the performance of a RAID5. Once the cache has been filled Squid uses a lot of small random writes which the worst case workload for RAID5, effectively reducing write speed to only little more than that of one single drive.

Generally seek time is what you want to optimize for Squid, or more precisely the total amount of seeks/s your system can sustain. Choosing the right RAID solution generally decreases the amount of seeks/s your system can sustain significantly.

意思就是讲
squid跑在raid1上还行
raid0则没什么好处
如果跑在raid5上
则性能要降低很多

awstats的web report页面里显示搜索关键字乱码的问题

awstats是一套非常好用的免费的日志分析软件

他是用perl实现的,支持web log、ftp log和mail log

而且它还能自动根据你浏览器的字符设置来选取语言(支持中文)

但是缺省安装的话有个问题

就是用来搜索的关键字如果是中文的话

显示出来是乱码的

这个问题其实好解决

在配置文件中把decodeutfkeys这个plugin打开就可以了

具体就是这一句:

LoadPlugin="decodeutfkeys"

不过打开这个plugin

需要perl模块儿Encode和URI::Escape的支持

apache中的AddDefaultCharset的问题

今天下午写一个php程序的时候

发现一个问题

我的php生成的页面(有中文字符)老是乱码

哪怕是在html代码的meta里声明编码方式为gb2312都还不行

抓包来看

发现apache返回给client的头信息里明确指出了编码方式为UTF8!

看来这肯定不是php程序的问题

我打开apache的配置文件httpd.conf一看

发现

AddDefaultCharset设置成了UTF8

看了看apache2的文档

发现AddDefaultCharset这个东东能够忽略html页面里meta的相关设置

我这里的问题正是如此!

因为在apache2中

AddDefaultCharset缺省是utf8

而在apache1.3中,AddDefaultCharset缺省是设为off的

所以apache1.3很少碰见这个问题

而apache2就很常见

于是乎

将AddDefaultCharset UTF8改成

AddDefaultCharset off

于是就ok了

体会:阴沟里翻船

终日打雁,反被雁啄瞎了眼

关于vim6.3里的变量$VIMRUNTIME

上周五一个朋友问我怎么修改vim(6.x的版本)里的变量$VIMRUNTIME的值

我找了一台机器

发现:

这个变量是装了vim-enhanced包,而且要是6.x以上版本才会有的

否则

缺省是没有的

而且这个变量缺省是指向目录/usr/share/vim/vimxx

上面这里的xx是vim的版本号,比如63

上面这个缺省指向是在vim里用":echo $VIMRUNTIME"来看的

不知道怎么改

于是google了一把

发现大多文章都提到通过修改$VIMRUNTIME/下

或$VIMRUNTIME/syntax/下的一些.vim文件来达到修改vim的配置的目的的方法

也还有几篇中文文档提到可以在~/.vimrc里设定环境变量VIMRUNTIME的值

但这些文档里都是讲将$VIMRUNTIME指向程序vim的实际位置

一般应该是/usr/bin/vim

最后还是回到vim里

用命令":help $VIMRUNTIME"找到了答案

看下面我摘抄的这一段:

 

The environment variable "$VIMRUNTIME" is used to locate various support files, such as the on-line documentation and files used for syntax highlighting.  For example, the main help file is normally"$VIMRUNTIME/doc/help.txt". You don’t normally set $VIMRUNTIME yourself, but let Vim figure it out.  This is the order used to find the value of $VIMRUNTIME:

1. If the environment variable $VIMRUNTIME is set, it is used.  You can use    this when the runtime files are in an unusual location.

2. If "$VIM/vim{version}" exists, it is used.  {version} is the version    number of Vim, without any ‘-’ or ‘.’.  For example: "$VIM/vim54".  This is    the normal value for $VIMRUNTIME.

3. If "$VIM/runtime" exists, it is used.

4. The value of $VIM is used.  This is for backwards compatibility with older    versions.

5. When the ‘helpfile’ option is set and doesn’t contain a ‘$’, its value is    used, with "doc/help.txt" removed from the end.

For Unix, when there is a compiled-in default for $VIMRUNTIME (check the output of ":version"), steps 2, 3 and 4 are skipped, and the compiled-in default is used after step 5.  This means that the compiled-in default overrules the value of $VIM.  This is useful if $VIM is "/etc" and the runtime files are in "/usr/share/vim/vim54".

Once Vim has done this once, it will set the $VIMRUNTIME environment variable. To change it later, use a ":let" command like this: >        

:let $VIMRUNTIME = "/home/piet/vim/vim54"