質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
HTTPS

HTTPS(Hypertext Transfer Protocol Secure)はHypertext Transfer プロトコルとSSL/TLS プロトコルを組み合わせたものです。WebサーバとWebブラウザの間の通信を暗号化させて、通信経路上での盗聴や第三者によるなりすましを防止します。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

SSL

SSL(Secure Sockets Layer)とは、暗号化されたプロトコルで、インターネット上での通信セキュリティを提供しています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

解決済

1回答

1019閲覧

【AmazonLinux2】Let's Encryptを使ってSSL化を実現したい

yastinbieber

総合スコア49

HTTPS

HTTPS(Hypertext Transfer Protocol Secure)はHypertext Transfer プロトコルとSSL/TLS プロトコルを組み合わせたものです。WebサーバとWebブラウザの間の通信を暗号化させて、通信経路上での盗聴や第三者によるなりすましを防止します。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

SSL

SSL(Secure Sockets Layer)とは、暗号化されたプロトコルで、インターネット上での通信セキュリティを提供しています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

0クリップ

投稿2021/01/29 06:56

前提・実現したいこと

Railsにて作成したアプリをEC2を利用してAWSにデプロイしました。
ドメイン取得まで完了し、http://www.xxxxxx.comの形であればサイト公開ができるようになりました。

そこからhttpsにてサイト公開ができるようにしたいと考え、
多く記事のあったLet's Encryptを使ってやってみることにしました。

こちらのサイトを参考にさせていただきながら進めていったのですが、最後の部分でエラーが発生してしまい検索等しても解決できなかったので相談させてください。

発生している問題・エラーメッセージ

Which names would you like to activate HTTPS for? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: torekabodymake.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): Requesting a certificate for torekabodymake.com Performing the following challenges: http-01 challenge for torekabodymake.com Waiting for verification... Challenge failed for domain torekabodymake.com http-01 challenge for torekabodymake.com Cleaning up challenges Some challenges have failed. IMPORTANT NOTES: - The following errors were reported by the server: Domain: torekabodymake.com Type: dns Detail: No valid IP addresses found for torekabodymake.com

試したこと

前提
イメージ説明
前提❷
DNSはroute53を使っています
イメージ説明

EPEL 7 パッケージをダウンロード

[ec2-user@ip-172-31-36-245 ~]$ sudo wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/

EPEL インストール

[ec2-user@ip-172-31-36-245 ~]$ sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm

EPEL を有効化

[ec2-user@ip-172-31-36-245 ~]$ sudo yum-config-manager --enable epel*

Certbot(Let's Encryptを自動的に使用してHTTPSを有効にするツール) のインストール

[ec2-user@ip-172-31-36-245 ~]$ sudo yum install certbot-nginx

結果

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd 246 packages excluded due to repository priority protections Resolving Dependencies ~~~ Installed: python2-certbot-nginx.noarch 0:1.11.0-1.el7 Dependency Installed: audit-libs-python.x86_64 0:2.8.1-3.amzn2.1 certbot.noarch 0:1.11.0-1.el7 checkpolicy.x86_64 0:2.5-6.amzn2 libcgroup.x86_64 0:0.41-21.amzn2 libselinux-python.x86_64 0:2.5-12.amzn2.0.2 libsemanage-python.x86_64 0:2.5-11.amzn2 policycoreutils-python.x86_64 0:2.5-22.amzn2 pyOpenSSL.x86_64 0:0.13.1-3.amzn2.0.2 pyparsing.noarch 0:1.5.6-9.amzn2 python-IPy.noarch 0:0.75-6.amzn2.0.1 python-ndg_httpsclient.noarch 0:0.3.2-1.el7 python-requests-toolbelt.noarch 0:0.8.0-3.el7 python-zope-component.noarch 1:4.1.0-5.el7 python-zope-event.noarch 0:4.0.3-2.el7 python-zope-interface.x86_64 0:4.0.5-4.amzn2.0.2 python2-acme.noarch 0:1.11.0-1.el7 python2-certbot.noarch 0:1.11.0-1.el7 python2-configargparse.noarch 0:0.11.0-2.el7 python2-distro.noarch 0:1.2.0-3.el7 python2-future.noarch 0:0.18.2-2.el7 python2-josepy.noarch 0:1.3.0-2.el7 python2-mock.noarch 0:1.0.1-10.el7 python2-parsedatetime.noarch 0:2.4-6.el7 python2-pyrfc3339.noarch 0:1.1-3.el7 python2-six.noarch 0:1.9.0-0.el7 pytz.noarch 0:2016.10-2.amzn2.0.1 setools-libs.x86_64 0:3.3.8-2.amzn2.0.2 Complete!

Certbotの実行

[ec2-user@ip-172-31-36-245 ~]$ sudo certbot --nginx

結果

Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): toreka.bodymake@gmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: n Account registered. Which names would you like to activate HTTPS for? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: torekabodymake.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): Requesting a certificate for torekabodymake.com Performing the following challenges: http-01 challenge for torekabodymake.com Waiting for verification... Challenge failed for domain torekabodymake.com http-01 challenge for torekabodymake.com Cleaning up challenges Some challenges have failed. IMPORTANT NOTES: - The following errors were reported by the server: Domain: torekabodymake.com Type: dns Detail: No valid IP addresses found for torekabodymake.com

仮説

前提❷で載せたDNS設定に関する部分でレコードセットの作成時にwwwを追記して作成をしました。
(タイプAのやつです
イメージ説明

この部分が影響して今回のエラーが生じてしまっているのでしょうか。
もしそうだとした場合同様にレコードセットを追加作成すれば良いのでしょうか?
(全く関係無かったらすみません

補足情報(FW/ツールのバージョンなど)

AmazonLinux2
AWS
Cloud9

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

そもそも正式な FQDN は www 付きですか? www なしですか?

www 付きなら、

Which names would you like to activate HTTPS for?

の時点で www なしを入力しているのがおかしいし、

www なしなら、
Route 53 にて A レコードがない

と思います。

投稿2021/01/29 07:02

68user

総合スコア2005

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yastinbieber

2021/01/29 07:12

コメントありがとうございます。 お恥ずかしながらFQDNというものを理解しておらずでして、調べてみたところ hostname -f を使って確認できるもので認識は間違っていないでしょうか? ----- [ec2-user@ip-172-31-36-245 ~]$ hostname -f ip-172-31-36-245.ap-northeast-1.compute.internal ----- コマンドを打ってみると上記のようになります。 ちなみにRoute 53 での設定は 下記サイトを参考におこないました。 https://qiita.com/syoma/items/360c09eddc8aed25fd37#%E3%81%8A%E5%90%8D%E5%89%8Dcom%E3%81%A7%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%92%E8%B3%BC%E5%85%A5%E3%81%97aws%E3%81%A8%E7%B4%90%E4%BB%98%E3%81%91
yastinbieber

2021/01/29 07:19

この点で申しますと > https://www.torekabodymake.com こちらのほうでアクセスをして欲しいと考えております。 その場合、 > Which names would you like to activate HTTPS for? こちらの質問があった際 https://www.torekabodymake.com のアドレスで設定をしてあげれば良いということでしょうか。
68user

2021/01/29 07:21

そうですね。入力したサーバに対して Let's 側がアクセスしにくるのですが、 www なしには A レコードがないため名前解決できず接続できなかったために 発生しているエラーに見えます。
yastinbieber

2021/01/29 07:31

ありがとうございます。 入力の仕方に関して最後にお伺いしたいのですが、 $ sudo certbot --nginx を打ち込むことで先ほどの Which names would you like to activate HTTPS for? という問いが出てくるのですが、 Which names would you like to activate HTTPS for? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: torekabodymake.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): ここからどのように入力をすれば良いのかお伺いできますでしょうか。 エンターの場合これまでどおりエラーが出てしまいますし、 c(cansel)を押すことで終了してしまいます。 また www.torekabodymake.com を入力したところで ** Error - Invalid selection ** というエラーが起き、再度which~ が出てきてしまいます。
yastinbieber

2021/01/29 07:48

度々すみません。 結局wwwは抜いたドメインを設定することにしました。 そうすることでそのままエンター押下でsslの設定を完了することができました。 細かくご説明いただきありがとうございました!
68user

2021/01/29 07:52

なるほど選択肢から選ぶ形だったのですね。失礼しました。 下記によると certbot は Apache の設定ファイルの ServerName などから拾っているようなので、そこが www なしだったのかもしれません。 https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04-ja いまどきは www なしのドメインのほうがよさげな感があるので、結果的にはよかったですね。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問