apache增加mod_encoding组件来支持中文url
步骤: 1. 准备如下包:(见附件)- mod_encoding-20021209.tar.gz
- mod_encoding.c.apache2.20040616
- mod_encoding.c-apache2.2-20060520.patch
2. 解压mod_encoding并打补丁
- tar zxvf mod_encoding-20021209.tar.gz
- cp mod_encoding.c.apache2.20040616 mod_encoding-20021209/mod_encoding.c
- cp mod_encoding.c-apache2.2-20060520.patch mod_encoding-20021209/
- cd mod_encoding-20021209
- patch -p0 < mod_encoding.c-apache2.2-20060520.patch
3.安装iconv-hook
- cd mod_encoding-20021209/lib
- ./configure
- make
- make install
- cp iconv* /usr/local/lib
- #vi /etc/ld.so.conf
- 添加 /usr/local/lib
- #ldconfig
- cd mod_encoding-20021209/
- ./configure
- --with-apxs=/usr/local/apache2/bin/apxs
- --with-iconv-hook=/usr/
- make
- gcc -shared -o mod_encoding.so mod_encoding.o -Wc,-Wall -Llib -liconv_hook
- cp mod_encoding.so /usr/local/apache/modules
- 增加下面类容
- #vi httpd.conf
- LoadModule encoding_module
- modules/mod_encoding.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>
- service httpd restart