민서네집

CentOS 6.4 에서 Tomcat 7 서버 - 웹페이지 한글 깨짐 현상 수정 본문

LINUX

CentOS 6.4 에서 Tomcat 7 서버 - 웹페이지 한글 깨짐 현상 수정

브라이언7 2013. 11. 21. 11:33

<테스트 환경>

Linux: CentOS 6.4

Web Server: Tomcat 7.0.47


웹페이지에서 한글 깨지는 현상에 대한 조치


CentOS 에서 Tomcat 서버의 server.xml 파일을 찾아서 


<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />


부분을 찾아서 URIEncoding="UTF-8" 을 추가했지만 여전히 웹페이지에서는 한글 깨짐.


* CentOS 6.4 버전에서 한글 깨짐 해결하는 법

=> catalina.sh 파일에서

-Dfile.encoding="utf-8" \  을 추가함.


[참조] < TOMCAT utf-8 OS 별로 한글 깨짐 해결 >

http://hotkkangs.tistory.com/8


그러나 catalina.sh 파일을 열고, 주석을 보면 이 파일을 직접 수정하는 것을 권장하지 않음.


#   Do not set the variables in this script. Instead put them into a script

#   setenv.sh in CATALINA_BASE/bin to keep your customizations separate.


/usr/share/apache-tomcat-7.0.47/bin 디렉터리에
setenv.sh 파일을 하나 만들어서, 그 안에 이렇게 넣음.

[root@localhost bin]# cat setenv.sh
#!/bin/sh
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=\"utf-8\""

[참고]

The startup scripts of tomcat will run a setenv.sh file if it exists. Create it (in the tomcat bin/ ) directory and write your customization there, e.g. that file can just contain the line:

< JAVA_OPTS 환경변수를 셋팅하는 법 >


Comments