Author Archive
一些有用apache重写规则
# 将domain.com/xxx转向www.domain.com/xxxRewriteCond %{HTTP_HOST} ^domain.com [NC]RewriteRule ^(.*)$ http://www.domain.com$1 [R=301,NC]# 将xxx.domain.com/yyy...重定向到www.domain.com/xxx/yyy..., xxx 5-20位, 字母开头只含字母, 数字以及"-"和"_"RewriteCond %{SERVER_NAME} ^([a-z][a-z0-9\-\_]{4,19})\.domain\.com [NC]RewriteRule ^(.+)$ %{SERVER_NAME}$1 [C]RewriteRule ^([a-z][a-z0-9\-\_]{4,19})\.domain\.com(.*)$ http://www.domain.com/$1$2 [R=301,NC]# 将首页www.domain.com转向www.domain.com/html/index.htmlRewriteCond %{HTTP_HOST} www\.domain\.comRewriteRule ^/$ http://www.domain.com/html/index.html [R=301,L]
Tags: apache, url_rewrite
lamp 相关配置 [Debian]
编译环境
Debian (Ubuntu)
apt-get install build-essential
apt-get install libncurses5-dev
sudo apt-get install libxml2-dev libcurl3-dev libpng-dev libmhash-dev libmcrypt-dev libxslt-dev libpspell-dev
Mysql编译安装参数
CHOST="i686-pc-linux-gnu" CFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" CXXFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-Community-Server --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-ndb-debug --without-isam --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
配置成功会提示:
MySQL has a Web [...]
解决webalizer 汉化后图表中乱码的问题
代码如下(webalizer_patch.pl):
#!/usr/bin/perl
###############################################################################
# webalizer_patch.pl
# 原作:http://mail.tses.tcc.edu.tw/nuke/sections.php?op=viewarticle&artid=139
# 修改:陶然 <taoran@taoran.net>
# 功能: 解决HTML汉化后图表中乱码的问题
# 方法:图表中乱码改用英文显示就正常了
# 需要修改: graphs.c output.c webalizer_lang.h lang.h
#
# tar zxf webalizer-2.01-10-src.tgz
# cd webalizer-2.01-10
# ./configure --with-language=simplified_chinese
# perl /path/of/webalizer_patch.pl ./
# make
# make install
#
###############################################################################
$file_graph = "$ARGV[0]/graphs.c";
if(!(-e $file_graph)) {
print "error open $file_graph
";
print "Usage:
perl $0 DIR
";
#DIR是源文件目录,比如 ./
exit;
}
#把图表中的月份和注释改成英文
@old_var = ("msg_h_hits",
"msg_h_pages",
[...]
apache下htaccess的Invalid command 'AuthUserFile'错误
使用了apache的 .htaccess做身份认证后, 无法访问
查看日志报错如下:
"Invalid command 'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration"
google 一下, 在apache配置文件里加入如下配置
LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.soLoadModule authz_owner_module /usr/lib/apache2/modules/mod_authz_owner.soLoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so
ok,问题解决
Tags: apache, htaccess, 身份验证
如何关闭time_wait连接
结合netstat和awk命令来统计网络连接数
From: http://hi.baidu.com/thinkinginlamp/blog/item/afbcab64b1ad81f3f6365453.html
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
会得到类似下面的结果,具体数字会有所不同:
LAST_ACK 1
SYN_RECV 14
ESTABLISHED 79
FIN_WAIT1 28
FIN_WAIT2 3
CLOSING [...]
三十四位网络知名动漫设计师联合制作贺岁动画
载入中……
Tags: 2008, 动漫, 贺岁
