다음은 하나의 Apache2에 사용자 계정별 Tomcat을 설치한후 mod-jk를 연동하는 방법이다.
1. 사용자 계정생성
아래와 같이 withpoem이라는 계정을 생성
adduser withpoem
2. 톰캣 다운로드
https://tomcat.apache.org/download-70.cgi 에서 다운로드한후
tar xvf apache-tomcat-7.0.70.tar.gz 하여 압축을 푼다.
3. 톰캣 server.xml 등록
conf 폴더의 server.xml을 아래와 같이 수정한다.
1) Server port=”8005″ shutdown=”SHUTDOWN” => Server port=”8006″ shutdown=”SHUTDOWN”
2) Connector port=”8080″ protocol=”HTTP/1.1″ => Connector port=”8081″ protocol=”HTTP/1.1″
3) Connector port=”8009″ protocol=”AJP/1.3″ => Connector port=”18010″ protocol=”AJP/1.3″
4) Host 태그에 도메인 설정
4. mod-jk 워커 설정
vi /etc/libapache2-mod-jk/workers.properties
workers.tomcat_home=/usr/share/tomcat7 workers.java_home=/usr/lib/jvm/java-8-openjdk-amd64 ps=/ worker.list=ajp13_worker,withpoem_worker # 기본 워커 worker.ajp13_worker.port=8009 worker.ajp13_worker.host=localhost worker.ajp13_worker.type=ajp13 worker.ajp13_worker.lbfactor=1 # WithPoem 워커 worker.withpoem_worker.port=8010 worker.withpoem_worker.host=localhost worker.withpoem_worker.type=ajp13 worker.withpoem_worker.lbfactor=1 worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=ajp13_worker
5. 아파치 가상호스트 등록/수정
cd /etc/apache2/sites-available vi www.withpoem.com.confServerAdmin admin@moramcnt.com DocumentRoot /home/withpoem/Service/PoemWebSolution/poem-web DirectoryIndex index.html index.jsp index.do ServerName www.withpoem.com Options FollowSymLinks AllowOverride None Order allow,deny Allow from all Require all granted Alias /upload /home/withpoem/Service/Data/PoemData/uploadOptions FollowSymLinks AllowOverride None Order allow,deny Allow from all Require all granted LogLevel warn ErrorLog /var/log/apache2/error-www.withpoem.com.log CustomLog /var/log/apache2/access-www.withpoem.com.log combined JkMount /*.do withpoem_worker JkMount /*.jsp withpoem_worker JkMount /*.json withpoem_worker6. 가상호스트 등록
sudo a2ensite www.withpoem.com.conf7. 톰캣 서비스 등록
1) 서비스 스크립트 작성
cd /etc/init.d/ vi tomcat7-withpoem#!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7-withpoem # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Should-Start: $named # Should-Stop: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Tomcat. # Description: Start the Tomcat servlet engine. ### END INIT INFO export CATALINA_HOME=/home/withpoem/tomcat/apache-tomcat-7.0.70 case "$1" in start) echo "Starting tomcat7-withpoem: " su - withpoem -c $CATALINA_HOME/bin/startup.sh ;; stop) echo "Shutting Down tomcat7-withpoem: " su - withpoem -c $CATALINA_HOME/bin/shutdown.sh ;; restart) echo "ReStarting tomcat7-withpoem: " su - withpoem -c $CATALINA_HOME/bin/shutdown.sh; su - withpoem -c $CATALINA_HOME/bin/startup.sh ;; *) echo "Usage: service tomcat7-widthpoem {start|stop|restart}" exit 1 esac exit 02) 파일퍼미션
chmod 755 tomcat7-withpoem3) 서비스 등록
update-rc.d tomcat7-withpoem defaults systemctl daemon-reload service tomcat7-withpoem stop service tomcat7-withpoem startCialis a du sens à frown marques et les femmes qui ne sont pas encouragés par le régime alimentaire quotidien de la consommation de phéromones. Résolution, si sa perturbé par des problèmes d'impuissance est approprié à portée de main et donc, en prenant une pilule de epharmaciefrance.com tout naturel.