let’s EncryptのワイルドカードSSL証明書を取得する。 IT by NHM - 2021-02-092021-05-25 certbotをインストールしてSSL証明書をリクエストする。二つ以上のワイルドカードでも問題ない。 sudo apt-get install certbot sudo certbot certonly --manual --server https://acme-v02.api.letsencrypt.org/directory --preferred-challenges dns -d *.test.co.jp -d *.test.com -m test@gmail.com --agree-tos 質問に答える。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing 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. (メアド共有しても良いか?) - - - - - - - - - - - - - - - - - -
EC2のapacheにSSL証明書を設定する。 IT by NHM - 2021-02-042021-05-25 いつものごとくamazonのドキュメント チュートリアル: Amazon Linux 2 に SSL/TLS を設定するhttps://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-2.html ステップ 1: サーバーで TLS を有効にする apacheが必要らしいのでインストールする。80,443をセキュリティグループで空けておくこと。 sudo yum install -y httpd 有効になっているかの確認 sudo systemctl is-enabled httpd disabled 有効化 sudo systemctl start httpd && sudo systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. インスタンスを最新にして、モジュールインストールする。 sudo yum update -y sudo yum install -y mod_ssl テスト用証明書を作成する。 cd /etc/pki/tls/certs sudo ./make-dummy-cert localhost.crt コメントアウトする。 vi /etc/httpd/conf.d/ssl.conf #SSLCertificateKeyFile /etc/pki/tls/private/localhost.key apache再起動 sudo systemctl restart httpd WEBブラウザでアクセスできることを確認する。Chromeだとページ表示できないかもしれないのでsafariやfirefox使おう。 epelインストール sudo amazon-linux-extras install epel -y 自動更新の設定をする。ついでにapache再起動も設定しておく。 cat /etc/crontab 39 1,13 * * * root certbot renew --no-self-upgrade * 3 * * * root systemctl restart httpd Certbot をインストールして実行する sudo wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/ sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm sudo yum-config-manager --enable epel* sudo yum repolist all /etc/httpd/conf/httpd.confの編集 sudo vi /etc/httpd/conf/httpd.conf Listen 80の後に追加 <VirtualHost *:80> DocumentRoot "/var/www/html" ServerName "example.com" ServerAlias "www.example.com" </VirtualHost> sudo
lightsailでwordpressにLet’sencryptの証明書を設定する IT by NHM - 2021-02-01 下記のオフィシャルにとても丁寧に書いてある。 Generate And Install A Let's Encrypt SSL Certificate For A Bitnami Applicationhttps://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/ Amazon Lightsail でホストされている Bitnami スタックに SSL 証明書をインストールする方法を教えてください。https://aws.amazon.com/jp/premiumsupport/knowledge-center/linux-lightsail-ssl-bitnami/ ようするにコマンド利用して設定してくださいってこと。 sudo /opt/bitnami/bncert-tool ドメイン聞かれるので記述する。複数ある場合は空白。wwwサブドメインを利用するかも聞かれるのでyes ---------------------------------------------------------------------------- Welcome to the Bitnami HTTPS Configuration tool. ---------------------------------------------------------------------------- Domains Please provide a valid space-separated list of domains for which you wish to configure your web server. Domain list []: test.co.jp test.com The following domains were not included: www.test.co.jp www.test.com. Do you want to add them? [Y/n]: Y リダイレクトしますか? HTTP -> HTTPS: Y, test.com -> www.test.com: Y, www.test.com -> test.com : n ---------------------------------------------------------------------------- Enable/disable redirections Please select the redirections you wish to enable or disable on your Bitnami installation. Enable HTTP to HTTPS redirection [Y/n]: Y Enable non-www to www redirection [Y/n]: Y Enable www to non-www redirection [y/N]: n --------------------------------------------------------------------------- Changes to perform この設定で設定しちゃって良いですか? yes The following changes will be performed to your Bitnami installation: 1. Stop web server 2. Configure web server to