Environment: centos-32 bit Server OS APACHE-2.0.59 php-5.2.5 mysql-5.0.45 zend-3.3
Premise: mod_headers has been statically compiled into Apache.
Steps:
1. Download and decompress Related Files
WebDAV resources JP has the latest mod_encoding version corresponding to apache2 download
# Wget http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
# Wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
# Tar zxfv mod_encoding-20021209.tar.gz.
# Cp mod_encoding.c.apache2.20040616 mod_encoding-20021209/mod_encoding.c
2. iconv_hook compilation and Installation
Install the iconv_hook before installing mod_encoding.
$ CD mod_encoding-20021209/lib
$./Configure
$ Make
# Make install
After completing the above operations, put the iconv_hook related so file under/usr/local/lib.
To search for the so file in the operating system, perform the following operations:
Open the/etc/lD. So. conf file and add a line pointing to the path of iconv_book, that is, "/usr/local/lib"
# Vi/etc/lD. So. conf
/Usr/local/lib [ESC], [:], [w], and [Q] Save and exit.
# Path = "$ path:/sbin"
# Ldconfig
3. Compile the mod_encoding Module
Into mod_encoding-20021209.tar.gz extract directory, that is, mod_encoding-20021209
#./Configure -- With-apxs =/usr/sbin/apxs -- With-iconv-hook =/usr/local/include
# Make
# Ls-l mod_encoding.o
Check whether the mod_encoding.o file has been generated and continue the operation. However, you can use Baidu or Google.
# Gcc-shared-O mod_encoding.so mod_encoding.o-WC,-wall-L/usr/local/lib-llib-liconv_hook
Generate the mod_encoding.so file and copy it to your Module Directory, which is usually $ {apache_home}/modules/
# Cp mod_encoding.so/usr/local/Apache/modules/mod_encoding.so
Httpd. conf settings (the following configurations are for reference only)
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>
4. Restart Apache. If no error is prompted.
You can upload Chinese files to your web directory.
Enter http: // domain name/uploaded Chinese file name in the browser to browse and download the file.