/etc/apache2/httpd.conf 에 mod_jk에 대한 설정 파일을 포함하도록 합니다.
Include /etc/apache2/modjk/httpd-jk.conf
아래는 httpd-jk.conf 파일의 내용입니다.
1번 라인과 같이 mod_jk.so 라이브러리를 Load하고
7번 줄과 같이 mod_jk의 worker를 설정합니다.
LoadModule jk_module libexec/apache2/mod_jk.so
<IfModule jk_module>
# We need a workers file exactly once
# and in the global server
JkWorkersFile /etc/apache2/modjk/workers.properties
# Our JK error log
# You can (and should) use rotatelogs here
JkLogFile /var/log/apache2/mod_jk.log
# Our JK log level (trace,debug,info,warn,error)
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# Our JK shared memory file
JkShmFile /var/log/apache2/mod_jk.shm
# This option will reject all requests, which contain an
# encoded percent sign (%25) or backslash (%5C) in the URL
# If you are sure, that your webapp doesn't use such
# URLs, enable the option to prevent double encoding attacks.
# Since: 1.2.24
# JkOptions +RejectUnsafeURI
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
# After setting JkStripSession to "On", mod_jk will
# strip all ";jsessionid=..." from request URLs it
# does *not* forward to a backend.
# This is useful, if all links in a webapp use
# URLencoded session IDs and parts of the static
# content should be delivered directly by Apache.
# Of course you can also do it with mod_rewrite.
# Since: 1.2.21
# JkStripSession On
# Start a separate thread for internal tasks like
# idle connection probing, connection pool resizing
# and load value decay.
# Run these tasks every JkWatchdogInterval seconds.
# Since: 1.2.27
JkWatchdogInterval 60
# Configure access to jk-status and jk-manager
# If you want to make this available in a virtual host,
# either move this block into the virtual host
# or copy it logically there by including "JkMountCopy On"
# in the virtual host.
# Add an appropriate authentication method here!
<Location /jk-status>
# Inside Location we can omit the URL in JkMount
JkMount jk-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
<Location /jk-manager>
# Inside Location we can omit the URL in JkMount
JkMount jk-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
다음은 /etc/apache2/modjk/workers.properties 파일 내용이다
worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true
worker.list=jk-manager
worker.jk-manager.type=status
worker.list=lb
#
# Defining a worker named node1 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.default.port=8009
worker.default.host=10.5.128.61
worker.default.type=ajp13
worker.default.lbfactor=1
worker.default.socket_timeout=1
worker.other.port=8009
worker.other.host=192.168.1.206
worker.other.type=ajp13
worker.other.lbfactor=1
worker.other.socket_timeout=1
#
# Defining a load balancer
#
worker.lb.type=lb
worker.lb.balance_workers=default,other
worker.lb.sticky_session=True
그 다음 mod_jk를 통해서 처리할 설정을 앞서서 설정한 VirtualHost 디렉티브에 추가합니다.
다음은 /etc/apache2/extra/httpd-vhosts.conf 파일 예제입니다.
5, 6번 줄과 같이 JkMount를 통해서 특정 URI에 대해서 mod_jk의 위에서 설정한 lb라는 이름의 worker로 처리하겠다고 명시합니다.
<VirtualHost *:80>
ServerName "localhost"
ServerPath /
Alias "/Users/geekshin/git/ProjectFolder"
JkMount /*.do lb
JkMount /*.json lb
</VirtualHost>
'Server' 카테고리의 다른 글
ubuntu remove old vmlinuz (0) | 2014.07.29 |
---|---|
Apache httpd서버 가상호스트 설정 (0) | 2014.06.04 |
jboss web.xml에서 시스템 프로퍼티 사용 (0) | 2014.06.04 |