2017/12/05 11:00

apache + wildfly 연동 Server/WAS



apache에 wildfly 연동 방법은 apache + tomcat 연동과 동일하다. 
(물론 다른 방식도 있지만.. )

AJP13을 이용한 mod_jk를 이용하면 된다. 

1. apache, wildfly, tomcat-connector 준비
 - mod_jk.so는 apache 폴더 내 module폴더에 복사

2. apache 설정

httpd.conf 파일 수정

#AJP13 Setting

 

LoadModule jk_module /etc/httpd/modules/mod_jk.so

JkWorkersFile /etc/httpd/conf/workers.properties

JkLogFile /var/log/mod_jk.log

JkLogLevel info

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

JkMount /* worker1


workers.properties생성

# Define 1 real worker using ajp13

 

worker.list=worker1

#worker.stat1.type=status

# Set properties for worker1 (ajp13)

worker.worker1.type=ajp13

worker.worker1.host=[HOST]

worker.worker1.port=[wildfly에 설정한 AJP PORT]

 

/*.do=worker1

 



3. wildfly 설정

<subsystem xmlns="urn:jboss:domain:undertow:4.0">

            <buffer-cache name="default"/>

            <server name="default-server">

                <ajp-listener name="ajp" socket-binding="ajp" scheme="http"/>

                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>

                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>

                <host name="default-host" alias="localhost">

                    <location name="/" handler="welcome-content"/>

                    <filter-ref name="server-header"/>

                    <filter-ref name="x-powered-by-header"/>

                    <http-invoker security-realm="ApplicationRealm"/>

                </host>

            </server>

            <servlet-container name="default">

                <jsp-config/>

                <websockets/>

            </servlet-container>

            <handlers>

                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

            </handlers>

            <filters>

                <response-header name="server-header" header-name="Server" header-value="WildFly/11"/>

                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

            </filters>

</subsystem>


파란색 부분 추가

4. cluster 구성시

# Domain Wildfly

# load balancer worker

worker.list=lbWorker

worker.lbWorker.type=lb

worker.lbWorker.balance_workers=worker1, worker2

 

# server 1 worker

worker.worker1.type=ajp13

worker.worker1.host=[HOST1]

worker.worker1.port=[AJP PORT1]

 

# server 2 worker

worker.worker2.type=ajp13

worker.worker2.host=[HOST2]

worker.worker2.port=[AJP PORT2]


기본 설정 방법 역시 apache + tomcat과 동일


덧글

댓글 입력 영역