Let's Encryptで新規ドメイン追加

この章を始める前に下記の設定が必要です
「Apache2 インストール」 or 「Nginx インストール」 「Apache2 バーチャルホスト 設定」 or 「Nginx バーチャルホスト 設定」 「無料SSLサーバー証明書 Let's Encrypt インストール」
Certbotインストール
[root@centos ~]# wget https://dl.eff.org/certbot-auto
[root@centos ~]# chmod +x certbot-auto
[root@centos ~]# ./certbot-auto

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: example.com
2: server-manual.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for example.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf.d/virtual-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf.d/virtual-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP ac                                                                                                                                                             cess.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/example.com/privkey.pem
   Your cert will expire on 2019-04-07. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again with the "certonly" option. To non-interactively renew *all*
   of your certificates, run "certbot-auto renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le
ヒント
ドメインを複数設定する場合も同様に「./certbot-auto」を実行してください。 Let's Encryptの有効期限は3ヶ月なので期限が切れる前に更新する必要があります。
virtual.conf編集
[root@centos ~]# vi /etc/httpd/conf.d/virtual.conf
↓下記を追加
<VirtualHost *:443>
    ServerAdmin postmaster@example.com
    DocumentRoot /home/example/public_html
    ServerName example.com

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
[root@centos ~]# systemctl restart httpd
ヒント
例として追加するドメイン名はexample.comとします。
Home PageTop