CentOS 6.4 YUM으로 Apache + Tomcat6 연동하기
1. 아파치 설치
[root@at ~]# yum install httpd httpd-devel
$ httpd-devel을 설치하는 이유는 커넥터 설시 apxs를 사용하기 때문
2. Tomcat 설치
[root@at ~]# yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps
3. Tomcat 설치 후 설정을 변경
3-1. servlet invoker 관련 내용의 주석 제거
[root@at ~]# vim /usr/share/tomcat6/conf/web.xml
<!-- This servlet has been deprecated due to security concerns. Servlets -->
<!-- should be explicitly mapped in web.xml -->
<!-- -->
<!-- The "invoker" servlet, which executes anonymous servlet classes -->
<!-- that have not been defined in a web.xml file. Traditionally, this -->
<!-- servlet is mapped to the URL pattern "/servlet/*", but you can map -->
<!-- it to other patterns as well. The extra path info portion of such a -->
<!-- request must be the fully qualified class name of a Java class that -->
<!-- implements Servlet (or extends HttpServlet), or the servlet name -->
<!-- of an existing servlet definition. This servlet supports the -->
<!-- following initialization parameters (default values are in square -->
<!-- brackets): -->
<!-- -->
<!-- debug Debugging detail level for messages logged -->
<!-- by this servlet. [0] -->
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
...
<!-- The mapping for the deprecated invoker servlet -->
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
3-2. Tomcat 연동을 위한 ROOT폴더
[root@at ~]# cd /usr/share/tomcat6/webapps
[root@at webapps]# ln -s /var/www/html /usr/share/tomcat6/webapps/ROOT
3-3. Tomcat6 context.xml 수정
[root@at webapps]# vim /usr/share/tomcat6/conf/context.xml
<!-- The contents of this file will be loaded for each web application -->
<!--<Context> -->
<Context reloadable="true" privileged="true">
4. Connector 설치
[root@at src]# wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz
[root@at src]# cd tomcat-connectors-1.2.37-src
[root@at tomcat-connectors-1.2.37-src]# cd native
[root@at native]# ./configure --with-apxs=/usr/sbin/apxs
[root@at native]# make && make install
$ 설치 후 /etc/httpd/modules에 mod_jk.so파일이 생성되었는지 확인
[root@at modules]# ls -l | grep mod_jk.so
-rwxr-xr-x 1 root root 1113496
workers.properties 파일 생성
[root@at conf.d]# pwd
/etc/httpd/conf.d
[root@at conf.d]# cat workers.properties
jkWorkersFile /etc/httpd/conf.d/workers.properties
jkLogFile /etc/httpd/logs/mod_jk.log
jkShmFile /usr/tomcat/logs/jk.shm
jkMount /*.jsp ajp13
jkMount /*.do ajsp13
jkMount /article/* ajp13
jkMount /uploadManager ajp13
jkMount /downManager ajp13
jkMount /alice-upload ajp13
5. 아파치와 톰캣 연동
[root@at conf.d]# vim /etc/httpd/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
jkMount /servlet/* ajp13
[root@at conf.d]#
'리눅스' 카테고리의 다른 글
Apache와 Tomcat를 연동하기 위해 workers.properties 파일을 설정하는 방법 (0) | 2013.08.16 |
---|---|
CentOS 6.4에서 Apache 웹 서버와 Apache Tomcat을 연동하는 방법_u2 (0) | 2013.08.16 |
[리눅스] rpm 명령어 (0) | 2013.08.14 |
[mysql] 리눅스 쉘상태에서 DB 및 테이블 생성(mysqlshow) (2) | 2013.08.14 |
[리눅스] gdb 사용법_core 덤프 (0) | 2013.08.14 |