内容へ移動
ゆーものメモ帳
ユーザ用ツール
管理
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
サーバ:ssl証明書:ssl証明書の取得_let_s_encrypt
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== SSL証明書の取得(Let's Encrypt) ====== <code> $ sudo yum install epel-release $ sudo yum install -y certbot python-certbot-apache # 何も指定しない場合、ドメインを選択肢から選ぶ $ sudo certbot # 予めドメインを指定して、実行する場合 $ sudo certbot certonly --webroot -w /var/www/example.com -d example.com -d www.example.com $ sudo ls -la /etc/httpd/conf.d/ $ sudoedit /etc/httpd/conf.d/vhost-le-ssl.conf $ sudo ls -la /etc/letsencrypt/live/www.example.com/ # CN= の後ろがサーバ名と同じか確認 $ openssl x509 -in /etc/letsencrypt/archive/www.example.com/fullchain1.pem -noout -subject # バーチャルホストの設定を確認 $ sudoedit /etc/httpd/conf.d/vhost.conf # ssl用のバーチャルホストを設定 $ sudoedit /etc/httpd/conf.d/vhost-le-ssl.conf # logファイルに prefix「ssl_」をつける # wwwのあり・なしの統一(なしの場合の例) RewriteEngine on RewriteCond %{SERVER_NAME} =www.example.com RewriteRule ^ https://example.com%{REQUEST_URI} [END,NE,R=permanent] # 再起動 $ sudo apachectl graceful </code> 各アドレスにアクセスし、想定通りの動きをするか確認。 ===== SSL でアクセスするとリダイレクト前に証明書エラーがでる場合 ===== 証明書が「www.example.com」もしくは「example.com」で発行した場合、発行しなかった方のドメインで「https://...」にアクセスすると証明書エラーが出てしまう。\\ Chrome では一見問題ないように見えて、デベロッパーツールの Console を見てみると以下のようなメッセージが表示される。 > Redirecting navigation www.example.com -> example.com because the server presented a certificate valid for example.com but not for www.example.com. To disable such redirects launch Chrome with the following flag: --disable-features=SSLCommonNameMismatchHandling この場合、証明書発行時にサブドメインも含めることで対処可能です。 <code> # 証明書発行時に -d オプションでサブドメインも含めて指定すればOK $ sudo certbot certonly --webroot -w /var/www/example.com -d example.com -d www.example.com # 既存の証明証がある場合は、以下のように聞かれるので「E」を押してエンターすればOK Do you want to expand and replace this existing certificate with the new certificate? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (E)xpand/(C)ancel: # 再起動 $ sudo apachectl graceful </code> 再度サイトにアクセスして問題ないことを確認します。
サーバ/ssl証明書/ssl証明書の取得_let_s_encrypt.txt
· 最終更新: 2020/08/20 12:37 by
humolife
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ