개발자의 노트
반응형

tomcat + nginx 연동하기 에서 tomcat을 설치했었다.

OpenSSL을 이용해 Self-Signed SSL 인증서 만들기 에서 자체 서명된 인증서를 생성했다.


이제, tomcat에서 ssl를 적용해보자.

apr을 이용할 것이므로, (Using an APR Connector to Configure SSL )


1. apache apr를 설치하고 (Apache Portable Runtime )
2. tomcat native library를 설치하자. (Apache Portable Runtime (APR) based Native library for Tomcat )


 

먼저 apr 설치

# cd /usr/local/src
# wget http://apache.tt.co.kr//apr/apr-1.4.6.tar.gz
# tar zxvf apr-1.4.6.tar.gz
# cd apr-1.4.6
# ./configure –prefix=/usr/local/apr
# make && make install


다음은 tomcat native library 설치.
$CATALINA_HOME 환경변수는 /etc/profile 에 설정되어있다고 치자.
하도 많이 해왔으니. 과정은 생략


# cd /usr/local/tomcat/bin
# tar zxvf tomcat-native.tar.gz
# cd tomcat-native-1.1.23-src/jni/native
# ./configure –prefix=$CATALINA_HOME –with-apr=/usr/local/apr/bin/apr-1-config
# make && make install


설치가 되었다.
tomcat native library 관련 파일이 $CATALINA_HOME/lib 에 들어가 있을 것이다.

사전 작업이 다 되었기 때문에 tomcat 설정파일만 수정해주면 된다.


# cd /usr/local/tomcat
# vi conf/server.xml

<!–
<Connector port=”8443″ protocol=”HTTP/1.1″ SSLEnabled=”true”
maxThreads=”150″ scheme=”https” secure=”true”
clientAuth=”false” sslProtocol=”TLS” />
–>
<Connector executor=”tomcatThreadPool”
port=”8443″
protocol=”org.apache.coyote.http11.Http11AprProtocol”
redirectPort=”8443″
connectionTimeout=”20000″
maxHttpHeaderSize=”8192″
maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″
enableLookups=”false” disableUploadTimeout=”true”
acceptCount=”100″
scheme=”https”
secure=”true”
clientAuth=”false”
sslProtocol=”TLS”
SSLEngine=”on”
SSLEnabled=”true”
SSLPassword=”t6830″
SSLCertificateFile=”/usr/local/ssl/www.xxxx.co.kr.crt”
SSLCertificateKeyFile=”/usr/local/ssl/www.xxxx.co.kr.key” />


저장하고, 톰캣을 재가동하자.

브라우저에 https://xxx.xxx.xxx.xxx:8443를 쳐서 화면이 나오면 성공….

profile

개발자의 노트

@곽코딩

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!