Confidential
[Megabox]Tomcat_설정보고서.docx
Last printed on 4/2/2013 10:11:00 AM
Nginx + Jboss EAP Proxy연동 가이드 문서
Project Name: Nginx + Jboss 연동 가이드
Department: 오픈소스 컨설팅 미들웨어
Focus Area: Nginx proxy test
Product/Process: Nginx 1.2.7 Stable version + EAP 5.1.2
Prepared By:
Document Owner(s) Project/Organization Role
Man-Woong Choi Technical Assistance
Project Status Report Version Control
Version Date Author Change Description
1.0 2013/04/02 Man-Woong Choi Document created
[Version #] [mm/dd/yy] [Change owner]
[Change 1]
[Change 2]
[Change n]
Confiugration Report
Confidential Page 2 4/2/2013
TABLE OF CONTENTS
1 1. 본 문서의 목적 ...................................................................................................................... 3
1.1 작업 일시 .................................................................................................................... 3
1.2 작업의 범위 .................................................................................................................. 3
2 NGINX 연동전 설정 확인 ........................................................................................................... 4
2.1 설치 시스템 정보 ........................................................................................................... 4
2.2 설치 전 필수 사항 .......................................................................................................... 4
3 NGINX 연동 설정..................................................................................................................... 6
3.1 Configuration Nginx .................................................................................................. 6
3.2 Nginx의 재 기동 .......................................................................................................... 8
3.3 Nginx 작동 상태 점검하기............................................................................................... 8
4 NGINX + JBOSS EAP PROXY연동 설정 .............................................................................. 10
5 APPENDICES .................................................................................................................... 11
5.1 Document Guidelines ............................................................................................. 11
5.2 Project Migration Report Sections Omitted .............................................................. 11
1
Confiugration Report
Confidential Page 3 4/2/2013
1. 본 문서의 목적
본 문서의 목적은 기존의 설치한 Nginx(Web Server)와 Jboss EAP 와의 연동에 필요한 내용을 정리한
문서입니다.
본 문서에는 Nginx와 Jboss EAP 설치에 대한 정보는 별도로 없으며, Nginx 와 Jboss 연동에 대한
정보만을 포함하고 있습니다.
1.1 작업 일시
구분 내용
시간 2013년 4월 3일 오전 10시~12시
장소 오픈소스 컨설팅 본사
작업자 최만웅 차장([email protected])
담당 매니저 최지웅 이사([email protected])
1.2 작업의 범위
작업에 대한 결과 리포트는 아래와 같은 내용을 포함하고 있습니다.
Nginx 1.2.7 Configuration
Confiugration Report
Confidential Page 4 4/2/2013
2 Nginx 연동전 설정 확인
2.1 설치 시스템 정보
설치 시스템 정보는 다음과 같습니다.
RHEL 6.4
[mwchoi-vm01:/]# uname -a
Linux mwchoi-vm01 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013
x86_64 x86_64 x86_64 GNU/Linux
[mwchoi-vm01:/]#
2.2 설치 전 필수 사항
Nginx + Jboss EAP를 연동하기 위해서는 다음의 내용이 선행하여야 합니다.
A. Nginx 설치
[mwchoi-vm01:/data/nginx]# pwd
/data/nginx
[mwchoi-vm01:/data/nginx]# ls -al
total 32
drwxr-xr-x. 8 root root 4096 Apr 2 15:04 .
drwxr-xr-x. 9 root root 4096 Apr 2 15:04 ..
drwxr-xr-x. 2 root root 4096 Apr 2 15:00 bin
drwxr-xr-x. 2 root root 4096 Apr 2 17:50 conf
drwxr-xr-x. 2 root root 4096 Apr 2 15:00 html
drwxr-xr-x. 2 root root 4096 Apr 2 17:49 logs
drwxr-xr-x. 2 root root 4096 Apr 2 17:50 pid
drwxr-xr-x. 7 root root 4096 Apr 2 16:47 tmp
[mwchoi-vm01:/data/nginx]#
B. Jboss EAP 설치
[mwchoi-vm01:/data/was/eap/jboss-eap-5.1]# pwd
/data/was/eap/jboss-eap-5.1
[mwchoi-vm01:/data/was/eap/jboss-eap-5.1]# ls -l
total 20
drwxrwxr-x. 8 501 505 4096 Jun 22 2012 jboss-as
Confiugration Report
Confidential Page 5 4/2/2013
drwxrwxr-x. 5 501 505 4096 Nov 11 2011 mod_cluster
drwxrwxr-x. 4 501 505 4096 Nov 11 2011 picketlink
drwxrwxr-x. 4 501 505 4096 Nov 11 2011 resteasy
drwxrwxr-x. 9 501 505 4096 Oct 14 2011 seam
[mwchoi-vm01:/data/was/eap/jboss-eap-5.1]#
C. Jboss EAP Instance 설정
구분 http 도메인 디렉터리
test1 8180 /data/was/eap/jboss-eap-5.1/jboss-as/server/test1
test2 8280 /data/was/eap/jboss-eap-5.1/jboss-as/server/test2
test3 8280 /data/was/eap/jboss-eap-5.1/jboss-as/server/test3
test4 8280 /data/was/eap/jboss-eap-5.1/jboss-as/server/test4
D. 연동 확인을 위한 test page 설정
instance명 테스트 파일 생성 경로 및 파일명
test1 /data/was/eap/jboss-eap-5.1/jboss-as/server/test1/deploy/ROOT.war/test1/server_info.jsp
test2 /data/was/eap/jboss-eap-5.1/jboss-as/server/test2/deploy/ROOT.war/test2/server_info.jsp
test3 /data/was/eap/jboss-eap-5.1/jboss-as/server/test3/deploy/ROOT.war/test3/server_info.jsp
test4 /data/was/eap/jboss-eap-5.1/jboss-as/server/test4/deploy/ROOT.war/test4/server_info.jsp
E. test page 내용
<!doctype html public "-//w3c/dtd HTML 4.0//en"> <html> <head> <title>Server Info</title> </head> <body bgcolor="#FFFFFF"> <p> <font face="Helvetica"> <p> <h1> Server Infomation </h1> server bind Address : <%=System.getProperty("jboss.bind.address")%><br>
Confiugration Report
Confidential Page 6 4/2/2013
server Name : <%=System.getProperty("jboss.server.name")%><br> <br> server Home : <%=System.getProperty("jboss.server.home.url")%><br> <p> serverInfo : <%=request.getSession().getServletContext().getServerInfo() %><br> serverName : <%=request.getServerName() %><br> serverPort : <%=request.getServerPort() %><br> contextPath : <%=request.getContextPath() %><br> </font> <p> </body>
</html>
F. Jboss EAP 기동 확인
[mwchoi-vm01:/data/was/eap]# ps -ef|grep java
root 23084 23030 ./run.sh -b 0.0.0.0 -c test1 -Djboss.service.binding.set=ports-01
root 23155 23101 ./run.sh -b 0.0.0.0 -c test2 -Djboss.service.binding.set=ports-02
root 23229 23175 ./run.sh -b 0.0.0.0 -c test3 -Djboss.service.binding.set=ports-03
root 23299 23245 ./run.sh -b 0.0.0.0 -c test4 -Djboss.service.binding.set=ports-04
3 Nginx 연동 설정
3.1 Configuration Nginx
실제 Nginx 와 Jboss 연동을 하기 위해서는 다음의 설정파일을 변경하여야 합니다.
[mwchoi-vm01:/data/nginx/conf]# ls -l
total 60
-rw-r--r--. 1 root root 1034 Apr 2 15:00 fastcgi.conf
-rw-r--r--. 1 root root 1034 Apr 2 15:00 fastcgi.conf.default
-rw-r--r--. 1 root root 964 Apr 2 15:00 fastcgi_params
-rw-r--r--. 1 root root 964 Apr 2 15:00 fastcgi_params.default
-rw-r--r--. 1 root root 2837 Apr 2 15:00 koi-utf
-rw-r--r--. 1 root root 2223 Apr 2 15:00 koi-win
-rw-r--r--. 1 root root 3463 Apr 2 15:00 mime.types
-rw-r--r--. 1 root root 3463 Apr 2 15:00 mime.types.default
-rw-r--r--. 1 root root 3040 Apr 2 17:50 nginx.conf
-rw-r--r--. 1 root root 2685 Apr 2 15:00 nginx.conf.default
-rw-r--r--. 1 root root 596 Apr 2 15:00 scgi_params
-rw-r--r--. 1 root root 596 Apr 2 15:00 scgi_params.default
Confiugration Report
Confidential Page 7 4/2/2013
-rw-r--r--. 1 root root 623 Apr 2 15:00 uwsgi_params
-rw-r--r--. 1 root root 623 Apr 2 15:00 uwsgi_params.default
-rw-r--r--. 1 root root 3610 Apr 2 15:00 win-utf
[mwchoi-vm01:/data/nginx/conf]#
Jboss http 포트와 연동을 위해 proxy 설정 부분을 nginx.conf 파일에 추가합니다.
[mwchoi-vm01:/data/nginx/conf]# vi nginx.conf
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
###################### proxy config append #######################
location /test1 {
proxy_pass http://192.168.0.82:8180;
}
location /test2 {
proxy_pass http://192.168.0.82:8280;
}
location /test3 {
proxy_pass http://192.168.0.82:8380;
}
location /test4 {
proxy_pass http://192.168.0.82:8480;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
설치가 모두 되었다면 디렉토리를 확인합니다.
[mwchoi-vm01:/data/nginx]# ls -l
total 24
drwxr-xr-x. 2 root root 4096 Apr 2 15:00 bin
Confiugration Report
Confidential Page 8 4/2/2013
drwxr-xr-x. 2 root root 4096 Apr 2 15:00 conf
drwxr-xr-x. 2 root root 4096 Apr 2 15:00 html
drwxr-xr-x. 2 root root 4096 Apr 2 15:00 logs
drwxr-xr-x. 2 root root 4096 Apr 2 15:00 pid
drwxr-xr-x. 2 root root 4096 Apr 2 15:01 tmp
[mwchoi-vm01:/data/nginx]#
3.2 Nginx의 재 기동
기존 Nginx 의 설정 정보 변경에 대한 적용을 위해서 다음의 명령어를 실행합니다.
[mwchoi-vm01:/data/nginx]# cd bin
[mwchoi-vm01:/data/nginx/bin]# ls -l
total 5288
-rwxr-xr-x. 1 root root 5414275 Apr 2 15:00 nginx
[mwchoi-vm01:/data/nginx/bin]# ./nginx –s reload
3.3 Nginx 작동 상태 점검하기
[mwchoi-vm01:/data/nginx/bin]# ps –ef|grep nginx
root 20165 1 0 15:01 ? 00:00:00 nginx: master process nginx
nobody 20166 20165 0 15:01 ? 00:00:00 nginx: worker process
root 20228 14774 0 15:08 pts/1 00:00:00 grep nginx
브라우저를 통한 Nginx 를 통한 Jboss에 deploy 된 페이지를 확인합니다.
http://${webserver_IP:port}/test1/server_info.jsp
Confiugration Report
Confidential Page 9 4/2/2013
정상적으로 보이는지 확인을 한 후 기타 test2, test3, test4 에 해당 하는 URL Mapping 에 따른 호출이
정상인지를 확인합니다
Confiugration Report
Confidential Page 10 4/2/2013
4 Nginx + Jboss EAP Proxy연동 설정
Prepared by __________________________________
Middleware Consultant, Open Source Consulting, Inc.
Approved by __________________________________
Project Manager
Confiugration Report
Confidential Page 11 4/2/2013
5 APPENDICES
5.1 Document Guidelines
http://wiki.nginx.org/NginxHttpProxyModule#proxy_pass
5.2 Project Migration Report Sections Omitted
N/A
Recommended