Skip to content

조회 수 21037 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

아파치 설치 여부 확인

 rpm -qa | grep httpd

 해서 설치 여부를 확인 한다. fedora core 5 이상에서는 패키지를 프로그램-->Add/Remove Software 에서

직접 삭제 추가 할수 있다.

 

JDK 설치

 

 

 1-1. JDK 다운로드 

       - http://java.sun.com 에 방문해서 리눅스용 JDK를 다운로드 받는다.

       - self-extracting file 선택, 파일명 jdk-6-linux-i586.bin (현재 최신 버전은 1.6 버전입니다.)

       - 참고) tomcat 5.5 버전에서는 J2SE 5.0 이상 버전에서 동작함.

     

 

 1-2. 다운로드 받은 파일을 리눅스의 알맞은 폴더에 업로드한다.


 1-3. 다음 명령을 사용해서 bin 파일을 실행 가능하도록 변경한다.
       $ chmod 555 jdk-6-linux-i586.bin

 

 1-4. bin 파일을 실행한다.
       $ ./jdk-6-linux-i586.bin

 

 1-5. 실행하면 라이센스에 대한 내용을 물어보는데 yes 를 입력한다.


 1-6. 설치가 자동으로 된다.

       보통 /use/local 폴더에서 bin 파일을 실행하면 /usr/local/jdk1.6.0 폴더에 설치됩니다.

 

 1-7. 링크를 걸어 표기하기 쉽게 한다.

       # ln -s j2sdk jdk1.6.0

 

 

톰캣의 설치

 

  2-1. TOMCAT 다운로드 

        - http://tomcat.apache.org 에 방문해서 tar.gz의 톰캣 바이너리 배포판을 다운로드 받는다.

        - Core 를 받는다. 파일명은 apache-tomcat-5.5.20.tar.gz 이다.

        - http://ftp.kaist.ac.kr/pub/Apache/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.tar.gz


  2-2. 다운로드 받은 파일을 리눅스의 알맞은 폴더에 업로드한다.


  2-3. 압축 파일을 /usr/local 폴더에 복사한다.


  2-4. 압축을 푼다.
        $ tar xvzf apache-tomcat-5.5.20.tar.gz

   
  2-5. tomcat 으로 링크를 걸어 놓는다.

        - /usr/local/apache-tomcat-5.5.20 폴더가 생긴다.

        # ln -s apache-tomcat-5.5.20 tomcat

      

  2-6. 환경변수에 등록

        - 톰캣을 실행하려면 다음과 같이 두 개의 환경 변수를 먼저 지정해야 합니다.

 

        # export JAVA_HOME=/usr/local/j2sdk

        # export CATALINA_HOME=/usr/local/tomcat

 

        - /etc/profile 에도 다음과 같이 등록한다.

 

       JAVA_HOME=/usr/local/j2sdk
       CATALINA_HOME=/usr/local/tomcat

 

       export JAVA_HOME CATALINA_HOME

 

 

TOMCAT 실행

 

  3-1. 톰켓 실행 

        # /usr/local/apache-tomcat-5.5.20/bin/catalina.sh start

 

  3-2. 사용하기 편리하게 링크를 걸어 놓는다.

        # ln -s /usr/local/apache-tomcat-5.5.20/bin/catalina.sh /etc/init.d/tomcat

 

  3-3. 정상동작하는지 확인한다.

        - http://test.com:8080

 

 

참고)

The file $CATALINA_HOME/bin/jsvc/native/tomcat.sh can be used as a template for starting Tomcat automatically at boot time from /etc/init.d. The file is currently setup for running Tomcat 4.1.x, so it is necessary to edit it and change the classname from BootstrapService to Bootstrap.

 

/usr/local/apache-tomcat-5.5.20/bin 에서 jsvc.tar.gz 파일을 압출해제 하고 ./jsvc-src/native/tomcat5.sh 를 사용한다.

 

Note that the Commons-Daemon JAR file must be on your runtime classpath to run Tomcat in this manner. The Commons-Daemon JAR file is in the Class-Path entry of the bootstrap.jar manifest, but if you get a ClassNotFoundException or a NoClassDefFoundError for a Commons-Daemon class, add the Commons-Daemon JAR to the -cp argument when launching jsvc.

 

 

mod jk 1.2 생성 (소스 버전)

 

  4-1. JK 다운로드

        - http://tomcat.apache.org/download-connectors.cgi 사이트에서 JK 1.2 소스 버전을 다운로드 받는다.

        - http://apache.edgescape.com/tomcat/tomcat-connectors/jk/source/jk-1.2.20/tomcat-connectors-1.2.20-src.tar.gz

        - 아파치는 더이상 mod jk2를 공식적으로 지원하지 않는다.
        - 아래와 같은 순서로 설치한다.

 

        $ tar xvzf tomcat-connectors-1.2.19-src.tar.gz
        $ cd tomcat-connectors-1.2.19-src
        $ cd native
        $ ./configure --with-apxs=/usr/local/apache/bin/apxs
        $ make 2> make_error.txt | tee make_stdout.txt

        $ make install

        or 
       $ cp ./apache-2.0/mod_jk.so /usr/local/apache2.2/modules

 

        - RPM으로 아파치를 생성했으면, apxs 파일이 없다.

        - 이럴 경우 httpd-devel 패키지를 설치하면 /usr/sbin/apxs 가 생성된다.

 

        # yum install httpd-devel

 

       ./configure --with-apxs=/usr/sbin/apxs

 

        참고) 컴파일시 다음과 같이 명령을 내리면 컴파일중 문제 발생시 확인이 용이하다.

        $ make 2> make_error.txt | tee make_stdout.txt

        

 

Apache 웹 서버와 Tomcat 5.x 연동

 

JK 1.2를 사용하여 Tomcat 5.x 버전과 연동할 수 있다.

  5-1. worker.properties 파일작성

 

##################### /etc/httpd/conf/worker.properties #####################

# 사용할 worker 목록을 지정한다. 아래는 local worker만 지정하였으며, 여러 개를 지정해야 할 경우 콤마로 구분
worker.list=worker1

 

# local worker에 대한 설정: 톰캣 5.x는 ajp13을 기본적으로 제공한다.
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

 

 

  5-2. tomcat.conf 파일을 작성

        - httpd.conf 파일이 로드되면서 함께 로드될 수 있도록 한다.

 

##################### /etc/httpd/conf/httpd.conf #####################

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf 

 

# 기본 으로 추가 되어 있다 두번 사용 하면 에러 나삼 추가 할피요 없음

참고)ServerRoot "/etc/httpd" <-- 아파치가 설치된 기본 위치

       ServerName localhost <-- 호스트 정보

       DocumentRoot "/web/webkores/webapp" <-- 변경

       --> DocumentRoot "/var/www/html" <--기본

       <Directory "/web/webkores/webapp">

        ~~~~

       </Directory>

      --> 기본

       <Directory "/var/www/html">

        ~~~~

       </Directory>

   이미지를 위해 추가 한다.<-추가 않해도 되는지 확인 해봐야되는딩 ㅋ

  Alias /resources/ "/web/webkores/webapp/resources/"

   <Directory "/web/webkores/webapp/resources">

     Options Indeses MultiViews 

     AllowOverride None

     Order allow,deny

     Allow from all

</Directory>

 

##################### /etc/httpd/conf.d/tomcat.conf  #####################

# tomcat 연동 모듈인 mod_jk를 로딩
LoadModule    jk_module  modules/mod_jk.so


# worker 정보가 설정된 파일의 경로 지정
JkWorkersFile   /etc/httpd/conf/worker.properties

JkLogFile       /etc/httpd/logs/mod_jk.log
JkLogLevel      error
JkLogStampFormat        "[%a %b %d %H:%M:%S %Y] "
JkRequestLogFormat      "%w %V %T"

 

# 어떤 요청을 톰캣으로 보낼 지 지정한다.
JkMount         /*.jsp worker1
JkMount         /servlet/* worker1
JkMount         /jsp-examples/* worker1
JkMount         /servlets-examples* worker1

 

  5-3. 연동테스트

        - http://test.com/index.jsp , http://test.com:8080/index.jsp 의 결과가 같은지 확인한다.

        - http://test.com/jsp-examples/ , http://test.com/servlets-examples/ 

          디렉터리가 정상적으로 보이고 내부의 JSP 파일 또는 서블릿 들이 정상적으로 실행되는지 확인한다.

 

 

  5-4. 데몬실행순서

         - tomcat 이 실행된 이후에 httpd 가 실행이 되어야 한다.

         -/톰켓 홈/bin/catalina.sh 하면 시작 된다 일케 하면 톰켓이 올라 가는것을 볼수 있다

         -/톰켓 홈/bin/startup.sh 하면 기본만 뜨삼

         - /etc/rc.d/init.d/httpd start <== 해서 아파치 실행

         - rc.local 에 tomcat 이 서버실행시 올라올 수 있도록 등록시켜 놓는다.

 

 

이와 관련된 보다 자세한 내용은 http://tomcat.apache.org/connectors-doc/howto/workers.html을 참고하기 바란다.

 

 

==>연동후 한글 깨지면

 톰켓의 server.xml 파일의

  connector port="8009"  에 URIEncoding="euc-kr" 을 추가 해준다.

 

 

 

 

참고 URL

 

JDK 설치 : http://cafe.naver.com/okjsp.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=109

JK 설치 : http://javacan.madvirus.net/


List of Articles
번호 제목 글쓴이 날짜 조회 수
88 (간단한 팁) 우분투에 Apache2 설치하기 ( apt-get ) 로키 2012.04.01 17600
87 *** glibc detected *** double free or corruption (!pre... ADMINPLAY 2010.05.03 26742
86 64bit 시스템에 ssl 설치 후 실행 시 X509_free 오류 ADMINPLAY 2008.10.07 15507
85 Address already in use: make_sock:could not bind to ad... ADMINPLAY 2009.01.10 23798
84 apache + oracle (오라클 DB 한글깨짐) ADMINPLAY 2010.02.24 19594
83 Apache - 도메인 포워딩 ADMINPLAY 2010.08.26 18807
82 Apache 1.3.12 httpd.conf 파일 한글설명 ADMINPLAY 2009.03.04 13361
81 apache 2.0.x , 2.2.x 버전대 max client 값 수정시 ADMINPLAY 2008.10.08 14799
80 Apache 2.2.17 (mod_url 하고 mod_rewrite 충돌) file ADMINPLAY 2011.08.18 20396
79 Apache 2.2.21 패치 (mod_proxy_ajp 패치와 apache killer... ADMINPLAY 2012.01.16 19641
78 apache cronolog를 이용한 Apache Log File 날짜 별로 생... ADMINPLAY 2012.01.16 23504
77 Apache expires 설정으로 브라우저 캐시 l2zeo 2013.03.18 11891
76 apache log 정리 ADMINPLAY 2008.12.14 13527
75 apache log에 그림이미지 파일 로그 안남기기 ADMINPLAY 2009.11.26 14666
74 Apache Make시 /usr/lib/libexpat.so: could not read sym... ADMINPLAY 2009.08.07 17943
73 Apache mod_deflate ADMINPLAY 2012.01.16 23376
72 apache server 2.2, Tomcat5.5 로드밸런싱 및 클러스터 ADMINPLAY 2009.12.10 19119
71 Apache Worker 방식의 이해 및 설정법 ADMINPLAY 2012.01.16 16955
70 Apache 로그레벨의 종류 ADMINPLAY 2012.01.16 20842
69 Apache 버전확인 ADMINPLAY 2008.12.23 15428
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234