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

この章を始める前に下記の設定が必要です
「Apache2 インストール」 or 「Nginx インストール」 「Apache2 バーチャルホスト 設定」 or 「Nginx バーチャルホスト 設定」 「無料SSLサーバー証明書 Let's Encrypt インストール」
Certbotインストール
[root@centos ~]# certbot certonly --webroot -w /home/example/public_html -d example.com
バーチャルホスト設定
[root@centos ~]# vi /etc/httpd/conf.d/virtual-le-ssl.conf
↓下記を追加
<VirtualHost *:443>
    ServerName example.com:443
    ServerAlias www.example.com
    DocumentRoot /home/example/public_html
    ErrorLog /var/log/httpd/example.com-error_log
    CustomLog /var/log/httpd/example.com-access_log combined env=!nolog
    SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
    <Directory "/home/example/public_html">
        Options Includes ExecCGI FollowSymLinks
    </Directory>
</VirtualHost>
[root@centos ~]# systemctl restart httpd
ヒント
例として追加するドメイン名はexample.comとします。
Home PageTop