上一篇: find使用范例
Apache 支持中文路径(URL)
[ 2009/09/12 04:12 | by selboo ]
让Apache 支持中文路径(URL)
比如 http://selboo.com.cn/色萝卜.txt 使用IE可以读取到文件内容
环境:Apache/2.2.12 (Unix) 需要给Apache 增加模块
mod_encoding-20021209.tar.gz
mod_encoding.c-apache2.2-20060520.patch
mod_encoding.c.apache2.20040616
下载文件 (已下载 307 次)
[root@localhost mod]# tar -zxvf mod_encoding-20021209.tar.gz
[root@localhost mod]# cp mod_encoding.c.apache2.20040616 mod_encoding-20021209/mod_encoding.c
[root@localhost mod]# cd mod_encoding-20021209
[root@localhost mod_encoding-20021209]# patch -p0 < mod_encoding.c-apache2.2-20060520.patch
[root@localhost mod_encoding-20021209]# cd lib/
[root@localhost lib]# ./configure
[root@localhost lib]# make
[root@localhost lib]# make install
[root@localhost lib]# cd ..
[root@localhost mod_encoding-20021209]# cp ../mod_encoding.c-apache2.2-20060520.patch ./
[root@localhost mod_encoding-20021209]# patch -p0 < mod_encoding.c-apache2.2-20060520.patch
[root@localhost mod_encoding-20021209]# ./configure --with-apxs=/usr/local/apache/bin/apxs --with-iconv-hook=/usr/include
[root@localhost mod_encoding-20021209]# gcc -shared -o mod_encoding.so mod_encoding.o -Wc,-Wall -Llib -liconv_hook
[root@localhost mod_encoding-20021209]# cp mod_encoding.so /usr/local/apache/modules/
修改 httpd.conf
LoadModule headers_module modules/mod_headers.so
<IfModule mod_headers.c>
Header add MS-Author-Via "DAV"
</IfModule>
<IfModule mod_encoding.c>
EncodingEngine on
NormalizeUsername on
SetServerEncoding GBK
DefaultClientEncoding UTF-8 GBK GB2312
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312
AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312
AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312
</IfModule>
<IfModule mod_headers.c>
Header add MS-Author-Via "DAV"
</IfModule>
<IfModule mod_encoding.c>
EncodingEngine on
NormalizeUsername on
SetServerEncoding GBK
DefaultClientEncoding UTF-8 GBK GB2312
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312
AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312
AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312
</IfModule>