Apache2+Tomcat6 url 中文乱码

yum install httpd-devel
 
tar zxvf mod_encoding_64.tar.gz

   cd mod_encoding_64

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

   cd lib

   chmod 755 configure

   ./configure --prefix=/usr

   make && make install

   ldconfig

   cd ../

   chmod 755 configure

   cp -p /usr/sbin/apxs /usr/bin

   ./configure –with-apxs=/usr/bin/apxs –with-iconv-hook=/usr/include

   make

   gcc -shared -o mod_encoding.so mod_encoding.o -Wc,-Wall -Llib-liconv_hook

   cp mod_encoding.so /etc/httpd/modules

【注意】最后一行代码中的/usr/lib/httpd/modules请根据modules位置自行修改之。

接下来,我们还是需要修改Apache的配置文件。

vi /etc/httpd/conf/httpd.conf     #编辑httpd.conf

<IfModule mod_encoding.c>
EncodingEngine on
NormalizeUsername on
SetServerEncoding UTF-8
DefaultClientEncoding UTF-8 GBK GB2312
</IfModule>

修改tomcat配置

tomcat下的conf/server.xml

 

<Connector rt="8080"  maxHttpHeaderSize="8192" 
maxThreads="150" minSpareThreads="25"maxSpareThreads="75" 
enableLookups="false" redirectPort="8443"acceptCount="100" 
connectionTimeout="20000"disableUploadTimeout="true" URIEncoding="UTF-8"/>  

<Connector port="8009" enableLookups="false"redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8" />



你可能感兴趣的:(apache,tomcat,乱码,url)