요구 사항:
1. 아파치( 80)에 요청이 들어온다.
2. 요청 정보에 따라서 동일한 IP에 포트만 다른 웹로직 서버로 분기하고 싶다.
해결:
1. 웹로직에 대한 DNS이름이 별도로 있다면, VirtualHost에 ServerName에 설정하면 OK
동일 머신(동일 ip)에 있는 두 개의 도메인을 다음과 같이 적용하고자 합니다.
사용자가 http://test01.penta.co.kr 을 입력하면, 웹로직의 7001번 포트로 이동하고,
http://test02.penta.co.kr 을 입력하면, 웹로직의 8001번 포트를 이동하도록 한다면...
다음의 [virtual host] 설정 작업이 필요하다.
<VirtualHost *:80>
ServerName test01.penta.co.kr
<Location / >
SetHandler weblogic-handler
WebLogicHost 210.108.181.42
WebLogicPort 8001
# MatchExpression *.jsp
Debug ON
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName test02.penta.co.kr
<Location / >
SetHandler weblogic-handler
WebLogicHost 210.108.181.42
WebLogicPort 8080
# MatchExpression *.jsp
Debug ON
</Location>
</VirtualHost>
2. DNS가 없다면 포트를 각각 열어서 할 수 밖에 없다.
######### FOR DEV #######
<VirtualHost *:80>
ServerName smcidap1
WebLogicHost smcidap1
WebLogicPort 37101
MatchExpression *.jsp
MatchExpression *service
Idempotent OFF
DynamicServerList OFF
# DocumentRoot /sks2/trust21_dev/ui/webdoc
ErrorLog /sks3/log/httpd/apache.err1.log
CustomLog /sks3/log/httpd/apache.access1.log common
Debug ALL
WLLogFile /sks3/log/httpd/apache.debug1.log
</VirtualHost>
######### FOR TEST #######
<VirtualHost *:8080>
ServerName smcidap1
WebLogicHost smcidap1
WebLogicPort 37001
MatchExpression *.jsp
MatchExpression *service
Idempotent OFF
DynamicServerList OFF
# DocumentRoot /sks2/trust21/ui/webdoc
ErrorLog /sks3/log/httpd/apache.err2.log
CustomLog /sks3/log/httpd/apache.access2.log common
Debug ALL
WLLogFile /sks3/log/httpd/apache.debug2.log
</VirtualHost>
3. URL에 들어가는 패턴이 틀리다면 Location 파라미터로 돌리면 된다.
위의 1번 항목의 Location처럼 하면 된다.
고려할 점은....
1. <Location / > 의 경우..
<Location / >
SetHandler weblogic-handler
WebLogicHost 210.108.181.42
WebLogicPort 8001
Debug ON
</Location>
위와 같이 <Location / > 사용하게 되면..
모든 리퀘스트에 대해 웹로직쪽으로 넘겨주게 됨으로 인하여..
이미지나 html 파일들 또한 아파치가 아닌 웹로직에서 처리하게 됩니다..
이점을 주의하셔야 하구요..
2. <Location /aaa > 의 경우..
<Location /aaa >
SetHandler weblogic-handler
WebLogicHost 10.135.1.95
WebLogicPort 8019
KeepAliveEnabled ON
</Location>
이 경우는 Location 명 다음에 "공백"이 존재하는 경우입니다..
이는 http://Domain_Name/aaa/sensewoo.jsp 와 http://Domain_Name/aaaaa/micael.jsp 모두 웹로직으로 넘겨주게 됩니다..
이해되시겠죠?? *^^*
3. <Location /bbb/> 의 경우..
<Location /bbb/>
SetHandler weblogic-handler
WebLogicHost 10.135.1.95
WebLogicPort 8020
KeepAliveEnabled ON
</Location>
이 경우는 웹브라우져에서 http://Domain_Name/bbb 로 호출한 경우 에러가 발생하고..
http://Domain_Name/bbb/ 로 호출한 경우만이 제대로 웹로직으로 넘겨지게 됩니다..