기본 콘텐츠로 건너뛰기

keytool 사용법

keytool.exe -genkey -alias juheon -keyalg RSA -keypass 1234qwer -storepass 1234qwer -keystore juheon.jks  keytool.exe -export -alias juheon -storepass 1234qwer -file juheon.cer -keystore juheon.jks  keytool.exe -importkeystore -srckeystore juheon.jks -destkeystore juheon.key.p12 -deststoretype PKCS12  D:\Java\32bit\jdk1.5.0_22\jre\lib\security\cacert  D:\Java\32bit\jdk1.5.0_22\bin\keytool.exe -import -alias tsasample -keystore  D:\Java\32bit\jdk1.5.0_22\jre\lib\security\cacert -file D:\workspace\Servers\tsa-server-web-config\tomcat.cer  keytool -import -alias somansa -keystore C:\Program Files\Java\jdk1.8.0_102\jre\lib\security\cacert -file c:\somansa.cer #인증서 생성  keytool -genkey -alias keyAlias -keyalg RSA -keypass changeit -storepass changeit –validity 9999 -keystore keystore.jks  keytool -export -alias keyAlias -storepass changeit -file server.cer -keystore keystore.jks  keytool -import -v -trustcacerts -alias keyAlias -file server.cer ...

Tomcat, Apache HTTP Server : ajp 연동


Tomcat과 Apache HTTP Server를 mod_jk를 이용해 연동해 본다.

1. mod_jk 다운로드

예전에는 Tomcat 사이트에서 컴파일된 mod_jk를 제공하였으나 지금은 IIS를 제외한 나머지 ajp module은 제공하지 않고 소스만 제공한다. 받아서 컴파일하라고...

다행히 Apache HTTP Server를 컴파일해서 제공하는 사이트에서는 mod_jk 모듈도 컴파일해서 제공한다. 다운로드  


2. mod_jk 설정

다운받은 mod_jk.so 파일을 "%APACHE_HOME%\modules" 로 위치시킨다. %APACHE_HOME%\conf\httpd.conf 파일을 열어 mod_jk module을 설정한다.

# Load mod_jk module
# Update this path to match your modules location
LoadModule    jk_module  modules/mod_jk.so

# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile conf/workers.properties

# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
# JkShmFile     logs/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile     logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel    info

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# Send everything for context /sample to worker named worker1 (ajp13)
# sample 하위 경로는 전부 worker1 이라는 이름의 worker로 ajp13 protocol로 전송한다.
JkMount  /sample/* worker1


3. worker 설정

mod_jk 설정에서 worker 파일을 "conf/workers.properties" 경로로 지정했으므로 해당 경로에 "workers.properties" 파일을 만들어 아래와 같이 내용을 작성한다.

# Define 1 real worker using ajp13
# worker1 이라는 이름의 work를 list에 추가한다.(mod_jk에 work1이라고 설정했으므로)
worker.list=worker1

# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

4. Tomcat connector 확인

server.xml 파일에 ajp connector의 설정을 확인한다.

...

<!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

...


5. 확인 

이렇게 설정했을 때 요청 처리 순서는 아래와 같다.

1. "http://localhost:80/sample/index.jsp" 라는 요청이 들어오면 80포트를 처리하는 Apache HTTP Server에서 요청을 받는다.

2. path가 /sample로 시작하므로 worker1 이라는 이름의 worker로 보낸다.

3. worker1은 요청을 ajp13 protocol로 "localhost"인 host의 8009 포트로 요청을 넘긴다.

4. Tomcat의 8009포트를 listening 하는 ajp connector는 해당요청을 받아 /sample/index.jsp 페이지를 호출한다.



댓글

이 블로그의 인기 게시물

Tomcat : JDBC JSP

JNDI를 이용하여 Database 연동을 해본다. 1. Oracle XE 설치 Oracel 11g XE를 다운받아 설치.  Download URL  사용자 까지 생성. 2. Resource 등록 %CATALINA_HOME%\conf\server.xml 파일에 DB Resource를 GlobalNamingResources에 등록. 그래야 다른 context에서 참조해서 사용할 수 있다. <GlobalNamingResources>     <!-- Editable user database that can also be used by          UserDatabaseRealm to authenticate users     -->     <Resource name="UserDatabase" auth="Container"               type="org.apache.catalina.UserDatabase"               description="User database that can be updated and saved"               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"               pathname="conf/tomcat-users.xml" />     <Resource name="portal.ds"             auth="Container" ...

Jeus was jsp 컴파일된 파일 경로

WAS 구동시 jsp 에러가 났을때 jsp가 컴파일된 파일을 확인하여 디버깅한다. jeus was jsp 컴파일된 파일 경로 %WAS_HOME%/WEBAPP/WEB-INF/.warjspwork/jeus_jspwork/ jsp 에러의 예) javax.servlet.ServletException: String index out of range: -13 at javax.servlet.http.HttpServlet.service(Unknown Source) at jeus.servlet.jsp.JspServletWrapper.executeServlet(JspServletWrapper.java(Compiled Code)) at jeus.servlet.engine.RequestDispatcherImpl.processCommonRequestDispatcher(RequestDispatcherImpl.java(Compiled Code)) at jeus.servlet.engine.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java(Compiled Code)) at jeus.servlet.engine.RequestDispatcherImpl.forward(RequestDispatcherImpl.java(Compiled Code)) at com.tomato.jef.servlet.BaseServlet.doDispatch(BaseServlet.java(Inlined Compiled Code)) at com.tomato.jef.bizframe.servlet.XecureHTMLMainServlet.doProcess(XecureHTMLMainServlet.java(Compiled Code)) at com.tomato.jef.bizframe.servlet.XecureHTMLMainServlet.doSessionProcess(Xec...

Vmware Fusion Window가 정상 종료가 되지 않을때

* 1번 방법   1. VMWare가 실행된 그 상태에서 Option키를 누르고 위에 메뉴바에서 Virtual Machine 메뉴를 클릭합니다.  2. 종료 메뉴가 Force 메뉴로 바뀌어 있습니다. Force shut down 이나 Force restart 합니다.  * 2번 방법   1. 유틸리티 - 활성 상태 보기로 들어가서 vmware 단어가 포함된 모든 프로세스를 강제종료 합니다.    2. 가상머신의 파일을 찾아갑니다. (eg. Documents/Virtual Machines/ 안에 있습니다.) 그리고 가상머신 파일의 오른쪽을 눌러 "패키지 내용 보기"로 들어갑니다.  3. ".vmem" 확장자로 된 모든 파일을 쓰레기통에 버리고 난 후 모두 비웁니다.  4. 다시 VMWare을 실행합니다. 어떤 오류가 나면 그냥 Disgard 하면됩니다.