2013. 5. 27. 17:41

apache + mod_jk + virtualhost 설정

Mod_jk 모듈 다운로드

 

http://tomcat.apache.org/download-connectors.cgi

 

직링

# wget http://apache.tt.co.kr//tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz

 

압축풀기

# tar xvfz tomcat-connectors-1.2.37-src.tar.gz

 

컴파일

# Cd tomcat-connectors-1.2.37-src/native

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

Apxs 위치를 모를경우

find / -name apxs

 

Apxs 설치가 안되어 있을경우

yum install httpd-devel

 

#make

#make install

 

Mod_jk 설정파일 생성

# vi /etc/httpd/conf/mod-jk.conf

#### mod_jk.conf ####

LoadModule jk_module modules/mod_jk.so

<IfModule jk_module> 

    JkWorkersFile    conf/workers.properties

    JkLogFile        logs/mod_jk.log

    JkLogLevel       info

    JkMountFile      conf/uri.properties

</IfModule>

 

# vi  /etc/httpd/conf/workers.properties

#### workers.properties ####

worker.list=worker1

worker.worker1.port=8009

worker.worker1.host=localhost

worker.worker1.type=ajp13

worker.worker1.lbfactor=1

 

# vi /etc/httpd/conf/uri.properties

/*.do=worker1

/*.jsp=worker1

#/*=worker1  (was 무조건 포워딩시)

 

Apache 설정에서 mod_jk include 설정

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

 

include conf/mod_jk.conf

 

참조 url : http://lng1982.tistory.com/63

http://www.openscope.net/2010/01/02/install-mod_jk

 

============== 추가

 

웹서버 1대  WAS서버 1대

WAS 인스턴스 5개 구성시

 

Conf/httpd.conf

 

Listen  포트 추가

Listen 7001

Listen 7002

Listen 7003

Listen 7004

Listen 7020

 

Mod_jk 연동(톰캣과 연동시에만)

Include conf/mod_jk.conf

 

# Virtual hosts 주석해제

Include conf/extra/httpd-vhosts.conf

 

=========================================================

workers.properties 추가

worker.list=web1,web2,web3,web4,web5

worker.web1.port=8009

worker.web1.host=아이피

worker.web1.type=ajp13

worker.web1.method=Session

worker.web1.sticky_session=True

 

worker.web2.port=8109

worker.web2.host=아이피

worker.web2.type=ajp13

worker.web2.method=Session

worker.web2.sticky_session=True

 

worker.web3.port=8209

worker.web3.host=아이피

worker.web3.type=ajp13

worker.web3.method=Session

worker.web3.sticky_session=True

 

worker.web4.port=8309

worker.web4.host=아이피

worker.web4.type=ajp13

worker.web4.method=Session

worker.web4.sticky_session=True

 

worker.web5.port=8409

worker.web5.host=아이피

worker.web5.type=ajp13

worker.web5.method=Session

worker.web5.sticky_session=True

 

=====================================================

Conf/extra/httpd-vhosts.conf

 

NameVirtualHost *:80

NameVirtualHost *:7001

NameVirtualHost *:7002

NameVirtualHost *:7003

NameVirtualHost *:7004

NameVirtualHost *:7020

 

<VirtualHost *:80>

    ServerAdmin webmaster@aa.com

    DocumentRoot "/apache/webdev.war"

    ServerName webdev

    ServerAlias localhost

    ErrorLog "/apache/webdev.war/logs/error_log"

    CustomLog "/apache/webdev.war/logs/access_log" common

</VirtualHost>

 

<VirtualHost *:7001>

    ServerAdmin webmaster@aa.com

    DocumentRoot "/apache/webdev.war"

    ServerName webdev

    ServerAlias localhost

    ErrorLog "/apache/webdev.war/logs/error_log"

    CustomLog "/apache/webdev.war/logs/access_log" common

    JkMount /* web1 ~ 5

</VirtualHost>

 

Ctrl+C + Ctrl+V  X4

'-=-= 컴퓨터 =-=- > 리눅스 & 유닉스' 카테고리의 다른 글

자바 설치  (0) 2013.06.22
SVN 명령어 및 기본 디렉토리 생성 , 설정  (0) 2013.06.16
SVN DUMP 및 LOAD 방법  (0) 2013.04.18
심볼릭 링크 생성 및 타겟 변경  (0) 2013.03.22
centos jboss 설치  (0) 2013.03.17