2007년 12월 11일 화요일

Tomcat in Fedora4

설치순서
1. apache(httpd-2.0.54, source)
2. apache-tomcat-connector(jakarta-tomcat-connectors-1.2.14.1-src, source)
3. tomcat(jakarta-tomcat-4.1.31, binary)
4. setting


1-1) ./configure --prefix=/usr/local/apache2 --enable-mods-shared=most --enable-modules=so --with-mpm=worker
1-2) make
1-3) make install
1-4) echo "/usr/local/apache2/lib" >> /etc/ld.so.conf
     echo "/usr/local/apache2/modules" >> /etc/ld.so.conf
     ldconfig
============================================================================================================


2-1) ./buildconf.sh
2-2) ./configure --with-apxs=/usr/local/apache2/bin/apxs
2-3) make
2-4) make install
2-5) /usr/local/apache2/conf/httpd.conf 파일수정
     모듈추가라인 가장 아래 다음과 같이 추가
     LoadModule jk_module modules/mod_jk.so
============================================================================================================


3-1) /usr/local/tomcat 에 설치
3-2) /usr/local/tomcat/conf/server.xml 파일수정
     서비스 컨텍스트 추가
     <Host name="xxx.xxx.co.kr">
         <Context path="" docBase="/home/xxx/public_html"
                  reloadable="true"/>
         <Alias>xxx.xxx.co.kr</Alias>
      </Host>
============================================================================================================


4-1) /usr/local/tomcat/conf/auto/mod_jk.conf 파일수정(없으면 생성)
다음과 같이 생성
<IfModule !mod_jk.c>
  LoadModule jk_module libexec/mod_jk.so
</IfModule>
JkWorkersFile "/usr/local/tomcat/conf/jk/workers.properties"
JkLogFile "/usr/local/tomcat/logs/mod_jk.log"
JkLogLevel emerg
<VirtualHost localhost>
    ServerName localhost
    JkMount /tomcat_admin ajp13
    JkMount /tomcat_admin/* ajp13
    JkMount /webdav ajp13
    JkMount /webdav/* ajp13
    JkMount /examples ajp13
    JkMount /examples/* ajp13
    JkMount /tomcat-docs ajp13
    JkMount /tomcat-docs/* ajp13
    JkMount /manager ajp13
    JkMount /manager/* ajp13
</VirtualHost>

4-2) /usr/local/tomcat/conf/jk/workers.properties 파일수정(없으면 생성)
다음과 같이 생성
# Start setup file
#
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=/
worker.list=ajp12, ajp13
# Definition for Ajp13 worker
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
#
# End setup file


4-3) /usr/local/tomcat/conf/web.xml 파일수정
<web-app> tag 내에 추가

   <filter>
    <filter-name>Set Character Encoding</filter-name>
    <filter-class>filters.SetCharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>EUC_KR</param-value>
    </init-param>
  </filter>
  <filter-mapping>
      <filter-name>Set Character Encoding</filter-name>
      <url-pattern>/*</url-pattern>
  </filter-mapping>

    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

4-4) 한글변환 문자 셋 / 디렉토리에 압축 풀기 (tar -zxvf classes.tgz -C /)

4-5) /usr/local/apache2/conf/httpd.conf 파일수정
다음과 같이 추가
JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties
Include /usr/local/tomcat/conf/auto/mod_jk.conf
JkLogFile /usr/local/tomcat/logs/mod_jk.log
JkLogLevel emerg

4-6) /usr/local/apache2/conf/httpd.conf 파일수정
버츄얼 호스팅 설정
#NameVirtualHost *:80   (주석제거)

다음과 같이 추가
<VirtualHost *:80>
    ServerAdmin root@xxx.xxx.co.kr
    DocumentRoot /home/xxx/public_html
    ServerName xxx.xxx.co.kr
    JkMount  /*.jsp ajp13
    JkMount  /servlet/* ajp13
</VirtualHost>

4-7) /etc/profile(환경변수 수정)
export LC_ALL=ko_KR.eucKR
export LANG=ko_KR.eucKR
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat
PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
export JAVA_HOME CATALINA_HOME
export set CLASSPATH=.:$CLASSPATH=/usr/local/java/lib/tools.jar:.:/usr/local/java/lib/dt.jar:/home/xxx/public_html/WEB-INF/lib/jCharts-0.7.0.jar:/home/xxx/public_html/WEB-INF/lib/Acme.jar:.:
export set CLASSPATH=.:$CLASSPATH=$CLASSPATH:/home/xxx/public_html/WEB-INF/lib/mysql-connector-java-3.1.7-bin.jar:/home/xxx/public_html/WEB-INF/lib/jxl.jar:/home/xxx/public_html/WEB-INF/lib/activation.jar:/home/xxx/public_html/WEB-INF/lib/mail.jar:/usr/local/java/lib/jfreechart-0.9.16.jar:.:
export set CLASSPATH=.:$CLASSPATH=$CLASSPATH:/home/xxx/public_html/WEB-INF/classes:.:
export set CLASSPATH=.:$CLASSPATH=$CLASSPATH:/home/hurec/public_html/WEB-INF/classes:.:
export set CLASSPATH=.:$CLASSPATH=$CLASSPATH:/usr/local/tomcat/common/lib/servlet.jar:.:

댓글 없음:

댓글 쓰기