Apache configuration on Linux supports download of Chinese name files

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.