Help us understand the problem. What is going on with this article?

Spring bootでSSL(HTTPS)を有効にする

More than 3 years have passed since last update.

はじめに

以下のURLを和訳しただけです。
https://www.drissamri.be/blog/java/enable-https-in-spring-boot/
簡単でした。

Step1. SSL証明書を取得する

本番の場合はどこか適切なところでお金を払ってSSL証明書を取得してください。
開発版なら以下のようにして作れます。Linuxで作るか、Windowsでもcygwinがあれば作れます。

keytool -genkey -alias tomcat
 -storetype PKCS12 -keyalg RSA -keysize 2048
 -keystore keystore.p12 -validity 3650

Enter keystore password:mypassword
 Re-enter new password:mypassword
 What is your first and last name?
 [Unknown]:
 What is the name of your organizational unit?
 [Unknown]:
 What is the name of your organization?
 [Unknown]:
 What is the name of your City or Locality?
 [Unknown]:
 What is the name of your State or Province?
 [Unknown]:
 What is the two-letter country code for this unit?
 [Unknown]:
 Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?

Step2. HTTPSを有効化する

設定ファイルに書くだけです。

application.properties
server.port: 8443
server.ssl.key-store: keystore.p12
server.ssl.key-store-password: mypassword
server.ssl.keyStoreType: PKCS12
server.ssl.keyAlias: tomcat

keystore.p12の場所は任意の場所に置けそうです。デフォルトではプロジェクトホームを探します。

あとはhttps://localhost:8443にアクセスしてみてください。

Step3. HTTPからHTTPSへリダイレクトする

試していないので省略

keigohtr
機械学習+自然言語処理/画像処理の研究者しつつ、ICT系WebAPIのマーケットプレイスApitoreを運営しつつ
https://apitore.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした