Using mod_encoding to enable Apache to support Chinese attachment names

Source: Internet
Author: User

The local test environment is apache2.2.31,php5.3.27 and the operating system is rhel6.4x86_64, using the Mod_encoding tool to enable Apache to support Chinese attachment names such as http://www.example.com/ Contract. rar

1. First modify the operating system locale, so that Linux local support Chinese, you can view the Chinese file name

Modify the/etc/sysconfig/i18n file
Will lang= "en_US. UTF-8 "
Sysfont= "Latarcyrheb-sun16"
Revision changed to

Lang= "ZH_CN. GB18030 "Language=" ZH_CN. Gb18030:zh_cn. GB2312:ZH_CN "supported=" ZH_CN. Utf-8:zh_cn:zh:en_us. Utf-8:en_us:en "sysfont=" Lat0-sun16 "

2. Source code compilation Mod_encoding

Download installation files and patches

wget Http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gzwget Tar XF mod_encoding-20021209.tar.gz cd Mod_ encoding-20021209

Overwrite patch file mod_encoding.c.apache2.20040616 to mod_encoding.c in local directory

Cp.. /mod_encoding.c.apache2.20040616./mod_encoding.c

Download a second patch file directly in the software catalog mod_encoding-20021209

wget Http://www.aconus.com/~oyaji/faq/mod_encoding.c-apache2.2-20060520.patch

Apply patch files

Patch-p0 <mod_encoding.c-apache2.2-20060520.patch

Install Iconv_hook before compiling, otherwise you will get an error

Enter the Lib directory

CD lib/#pwd/server/tools/mod_encoding-20021209/lib./configure--prefix=/usr make do install Ldconfig

Compile install mod_encoding, my Apache directory is/application/apache, need to install Apache when adding APXS module, compile without make install

Cd.. ./configure--with-apxs=/application/apache/bin/apxs--with-iconv-hook=/usr/include make Gcc-shared-o mod_ Encoding.so Mod_encoding.o-wc,-wall-llib-liconv_hook

Copy the generated mod_encoding.so module to the Apache modules directory

CP mod_encoding.so/application/apache/modules/



3. Modifying the Apache configuration file

Requires Headers_module support to view Apache-compiled modules

# Apachectl-l|grep Mod_head MOD_HEADERS.C

My Apache itself has been brought, there is no need to add this module, if not, you need to include the following line in the httpd.conf, if the module file exists

LoadModule Headers_module modules/mod_headers.so

Modify the Apache master configuration file httpd.conf, add the following:

LoadModule encoding_module modules/mod_encoding.soheader Add Ms-author-via "DAV" Encodingengine onnormalizeusername Onsetserverencoding gbkdefaultclientencoding UTF-8 GBK gb2312addclientencoding "(Microsoft. * DAV $)" UTF-8 GBK Gb2312add Clientencoding "Microsoft. * DAV" UTF-8 GBK GB2312

第2-8 line can be placed at the end of the configuration file

Check the syntax, and restart Apache, test Chinese attachments can be downloaded as normal, the relevant accessories may also be downloaded directly from this article, has been packaged

Using mod_encoding to enable Apache to support Chinese attachment names

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.