SSLまたはhttpsをサポートするようにTomcatを設定する方法
SSLまたはhttps接続をサポートするようにTomcat 6.0を設定する方法を説明するガイド。
1.キーストアを生成する
まず、 “keytool`”コマンドを使用して自己署名証明書を作成します。
キーストアの作成プロセス中に、パスワードを割り当てて証明書の詳細を記入する必要があります。
$Tomcat\bin>keytool -genkey -alias mkyong -keyalg RSA -keystore c:\mkyongkeystore
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: yong mook kim
What is the name of your organizational unit?
//omitted to save space
[no]: yes
Enter key password for <mkyong>
(RETURN if same as keystore password):
Re-enter new password:
$Tomcat\bin>
ここで、 ”
c:¥
“にある ”
mkyongkeystore
“という名前の証明書を作成しました。
$Tomcat\bin>keytool -list -keystore c:\mkyongkeystore Enter keystore password: Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry mkyong, 14 Disember 2010, PrivateKeyEntry, Certificate fingerprint (MD5): C8:DD:A1:AF:9F:55:A0:7F:6E:98:10:DE:8C:63:1B:A5 $Tomcat\bin>
2. server.xmlのコネクタ
次に、Tomcatのサーバー構成ファイルを__ $ Tomcat \ conf \ server.xmlに配置し、SSLまたはhttps接続をサポートする
connector
要素を追加して変更します。
ファイル:$ Tomcat \ conf \ server.xml
//...
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="c:\mkyongkeystore"
keystorePass="password"/>
//...
-
注意** `keystorePass =” password “は” keytool “コマンドでキーストアに割り当てたパスワードです。
3.完了
保存してTomcatを再起動し、
https://localhost:8443/

この例では、Google Chromeを使用してTomcat設定のSSLサイトにアクセスしていますが、httpsプロトコルの前に十字アイコンが表示されることがあります。これは自己署名証明書が原因であり、Google Chromeは信用できません。
運用環境では、http://www.verisign.com/ssl/[verisign]のような信頼できるSSLサービスプロバイダから署名入りの証明書を購入するか、独自のCAサーバーで署名することを検討してください