[웹서버] apache + tomcat 설치
apache 와 tomcat 설치기 입니다. 제가 적은것도 있지만..모두 각각의 설치 기록을
적은거라 주관적인 부분에 이해하시기 힘드신 사항이 많은거 같더군요..다른분의 설
치기를 올립니다. 참고하시길…
jsp,servlet 을 지원하는 톰캣(jsp,servlet container) 과 아파치(web server)를 연동하는
방법입니다.
[선결요건]
1) JDK /* mandatory */
2) javamail /* optional */
3) JAF(JavaBeans Activation Framework) /* optional */
4) Oracle 8i /* optional */
[설치순서]
1) apache compile and install (source with DSO)
2) tomcat install (binary)
3) mod_jserv.so into apache/libexec
[1] apache building with DSO support
ftp://ftp.apache.org
[/usr/local/src/apache_1.3.19]# gzip -d apache_1.3.19.tar.gz
[/usr/local/src/apache_1.3.19]# tar xvf apache_1.3.19.tar
[/usr/local/src/apache_1.3.19]# ./configure
–prefix=/usr/local/apache –enable-module=all –enable-shared=max
[/usr/local/src/apache_1.3.19]# make
[/usr/local/src/apache_1.3.19]# make install
[2] tomcat install (binary)
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin/jakarta-tomcat-3.2.1.tar.gz
[/usr/local/src/jakarta-tomcat-3.2.1]# gzip -d jakarta-tomcat-3.2.1.tar.gz
[/usr/local/src/jakarta-tomcat-3.2.1]# tar xvf jakarta-tomcat-3.2.1.tar
[/usr/local/src/jakarta-tomcat-3.2.1]# mv jakarta-tomcat-3.2.1 /usr/local/tomcat1
[3] mod_jserv.so into apache/libexec
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin/linux/i386/mod_jserv_tomcat.so
[/usr/local/src]# cp mod_jserv_tomcat.so /usr/local/apache/libexec/mod_jserv.so
[4] Envrionment Variable Setup
[/usr/local/src]# vi /etc/profile
————————————————————————————————–
CLASSPATH=”.:/usr/local/tomcat1/lib/servlet.jar:/home/oracle/product/8.1.5/jdbc/lib/classes12.jar”
CLASSPATH=”$CLASSPATH:/home/oracle/product/8.1.5/jdbc/lib/816oraclejdbc/classes12.zip”
CLASSPATH=”$CLASSPATH:/home/oracle/product/8.1.5/jdbc/lib/816oraclejdbc/nls_charset12.zip”
CLASSPATH=”$CLASSPATH:/usr/local/tomcat1/lib/xml.jar”
export
CLASSPATH=”$CLASSPATH:/usr/local/javamail/mail.jar:/usr/local/jaf/activation.jar”
export JAVA_HOME=/usr/local/java
export TOMCAT_HOME=/usr/local/tomcat1
—————————————————————————————————
[/usr/local/src]# . /etc/profile
[5] Apache Web Server Configuration File
httpd.conf 파일의 맨 마지막 줄에 다음의 include 문을 추가함.
[/usr/local/apache/conf]# vi httpd.conf
———————————————-
Include /usr/local/tomcat1/conf/tomcat.conf
———————————————-
[6] Tomcat Configuration File
[/usr/local/tomcat1/conf]# vi tomcat.conf
——————————————————————————-
###############################################################################
# Apache JServ Configuration File #
###############################################################################
LoadModule jserv_module /usr/local/apache/libexec/mod_jserv.so
<IfModule mod_jserv.c>
ApJServManual on
ApJServDefaultProtocol ajpv12
ApJServSecretKey DISABLED
ApJServMountCopy on
ApJServLogLevel notice
######## Virtual Hosts
<VirtualHost 211.34.23.21>
ServerName ad1.mediachannel.co.kr
DocumentRoot /usr/local/tomcat1/webapps/Superman
ApJServDefaultPort 8007
ApJServMount default ajpv12://211.34.23.21:8007/Superman
ApJServMount /Bang/servlet ajpv12://211.34.23.21:8007/Bang
AddType text/jsp .jsp
AddHandler jserv-servlet .jsp
</VirtualHost>
<VirtualHost 211.34.23.27>
ServerName ad2.mediachannel.co.kr
DocumentRoot /usr/local/tomcat2/webapps/Superman
ApJServDefaultPort 8008
ApJServMount default ajpv12://211.34.23.27:8008/Superman
ApJServMount /Bang/servlet ajpv12://211.34.23.27:8008/Bang
AddType text/jsp .jsp
AddHandler jserv-servlet .jsp
Alias /Superman /usr/local/tomcat2/webapps/Superman
<Directory “/usr/local/tomcat2/webapps/Superman”>
Options Indexes
DirectoryIndex index.htm index.jsp
</Directory>
</VirtualHost>
</IfModule>
——————————————————————————-
[/usr/local/tomcat1/conf]# vi server.xml
Context추가 : 웹브라우저에서 사용할 URL 정의 부분으로 보면 된다.
tomcat.conf 파일과 반드시 일치해야 한다.
——————————————————————————-
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<Server>
;
;
;중략
;
<Context path=”/” docBase=”webapps/Superman” debug=”0″
reloadable=”false” >
</Context>
<Context path=”/Bang” docBase=”webapps/Bang” debug=”0″
reloadable=”false”>
</Context>
</ContextManager>
</Server>
——————————————————————————-
[7] Tomcat,Apache Running and Shutdown
——————————————-
# /usr/local/tomcat1/bin/startup.sh
# /usr/local/apache/bin/apachectl start
# /usr/local/tomcat1/bin/shutdown.sh
# /usr/local/apache/bin/apachectl stop
——————————————-
아파치-톰캣 환경에서 서버를 구성하는데 꽤 도움이 되는 문서는 아래와 같다.
——————————————————————————-
http://kldp.mirror.uos.ac.kr/KoreanDoc/html/Tomcat-KLDP/Tomcat-KLDP-3.html
http://webdox.co.kr/docs/application/tomcat.jsp
——————————————————————————-