OS: solaris10, oracle: oracle 10.2
apache : httpd-2.2.8
tomcat: apache-tomcat-6.0.16
tomcat-connectors-1.2.26
oracle: oracle10gr2를 /oracle에 설치
java: solaris10 설치때 설치된 java를 사용.
apache2는 sunstudio12 로 컴파일 했음.(/usr/local/apache2)
tomcat은 바이너리를 받아서 설치했음.(/usr/local/apache-tomcat-6.0.16)
ln -s /usr/local/apache-tomcat-6.0.16 /usr/local/apache-tomcat
chown -R tomcat:tomcat /usr/local/apache-tomcat-6.0.16
tomcat-connector는 apxs로 컴파일.(mod_jk.so 생성)
/etc/profile 에 추가한 내용
JAVA_HOME=/usr/jdk/jdk1.5.0_14
/usr/local/apache2/conf/httpd.conf 에 추가한 내용
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat “%w %V %T”
JkMount /examples/jsp/* ajp13
JkMount /examples/servlets/* ajp13
/usr/local/apache2/conf/workers.properties 를 생성
workers.tomcat_home=/usr/local/apache-tomcat
workers.java_home=/usr/jdk/jdk1.5.0_14
ps=/
worker.list=ajp12, ajp13
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stder
JDBC 설정
$ORACLE_HOME/jdbc/lib/classes12.jar 을 /usr/local/apache-tomcat/lib에 복사.
oracle연동 테스트를 위해 oracle.jsp를 만들어서 테스트(\”는 “로 바꾸면됨).
주의할점은 아래 스크립트의 ip주소는 tnslistener에 설정된 ip주소라는것.
<%@ page language=\”java\” import=\”java.sql.*\” contentType=\”text/html;charset
=KSC5601\” %>
<%
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(\”jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521
:ORACLE_SID\”,\”oracle_user\”,\”oracle_user_passwd\”);Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(\”select * from BONUS\”);
if (rs==null)
{
out.println(\”암것도 없다\”);
}
else
{
out.println(\”뭔가 있다\”);
}stmt.close();
conn.close();
%>
가상호스트설정
/usr/local/apache2/conf/extra/httpd-vhosts.conf 에 가상 호스트를 설정한다.
<VirtualHost *:80>
ServerAdmin e@ma
DocumentRoot “/export/home/userid/public_html”
ServerName ggg.co.kr
ServerAlias ggg.co.kr
ErrorLog “logs/error_log”
CustomLog “logs/access_log” commonJkMount /*.jsp ajp13
JkMount /servlet/* ajp13</VirtualHost>
/usr/local/apache-tomcat/conf/server.xml 에 다음을 추가.
<Host name=”ggg.co.kr” appBase=”/export/home/userid/public_html”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
</Host>
5 comments
Skip to comment form
tomcat-connectors-version/native 아래에서
./configure –prefix=/usr/local/tomcat-connectors –with-apxs=/usr/local/apache2/bin/apxs
Virtual Host를 사용하지 안을 경우 apache의 DocumentRoot에서 jsp가 실행되지 않을 수 있다.
이 때는 다음을 확인하라.
server.xml 화일에…
위에 적어줌.
DocumentRoot는 아파치의 document root와 동일하게
아파치 설정에서 DocumentRoot를 바꿨을때 access-deniey 가 발생하는 경우
아래 설정이 되어 있는지 확인.
Options FollowSymLinks
AllowOverride None
Order deny,allow
# Deny from all
Allow from all
export ORACLE_BASE=/oracle;
export ORACLE_HOME=/oracle/product/10gr2;
export ORACLE_SID=fox;
export ORACLE_OWNER=oracle;
export ORACLE_PATH=$ORACLE_HOME/bin;
export ORACLE_DOC=$ORACLE_HOME/ocommon/nls/admin/data;
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib32:$ORACLE_HOME/lib:$ORACLE_HOME/jdbc/lib;
PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin:/usr/local/bin:$ORACLE_HOME/bin:$ORACLE_HOME/network/admin;
export PATH;
#LANG=c;
export CATALINA_HOME=/usr/local/apache-tomcat
#export CONNECTOR_HOME /usr/local/
export TOMCAT_HOME=/usr/local/apache-tomcat
export JAVA_HOME=/usr/j2se
export JRE_HOME=/usr/j2se/jre
export PATH=$PATH:$JAVA_HOME:$JAVA_HOME/jre/bin
#export CLASSPATH=$JAVA_HOME/lib/tools.jar
export CLASSPATH=$ORACLE_HOME/jdbc/lib/classes12.jar
oracle 계정에서 catalina 관련 환경설정이 없으면, 오라클과 연동에 문제가 있다.
Context path=”” docBase=”www” debug=”0″ reloadable=”true” workDir=”/home/www/WEB-INF/work”
/Context
2번 코멘트에 없는부분이 이 내용일듯…;ㅡㅡ
너무 오래되서 기억이 안남 …