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