0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

TomcatをHTTPS化する方法

Posted at

前提条件

すでにTomcatがインストールされいる状態

自己証明書の作成

Powershellを開く

以下のコマンドを実行し、自己証明書を作成

New-SelfSignedCertificate `
  -Type SSLServerAuthentication `
  -Subject "localhost" `
  -DnsName "localhost" `
  -KeyLength "4096"`
  -KeyExportPolicy Exportable `
  -NotAfter (Get-Date).AddYears(1)

「コンピュータ証明書の管理」を開く

上記で作成した証明書を右クリックし、「すべてのタスク」>「エクスポート」を押下

「証明書のエクスポートウィザード」画面にて「はい、秘密キーをエクスポートします」にチェックオンする

「証明書のエクスポートウィザード」画面にてパスワードを入力する

「証明書のエクスポートウィザード」画面にて証明書のエクスポート先を「<Tomcatインストールフォルダ>\conf」に設定する

証明書のバインド

「<Tomcatインストールフォルダ>\conf\server.xml」を開く

「server.xml」に以下を記載する

    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="証明書のフルパス"
                         certificateKeystorePassword="証明書をエクスポートした際に設定したパスワード"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>

Tomcatを再起動する

動作確認

「ユーザ証明書の管理」を開く

作成した証明書を「信頼されたルート証明書機関」>「証明書」に配置する

以下でアクセスする
https://localhost:8443/

以下の画面が表示されれば完了

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?