wiki:Let's encrypt設定方法(CentOS)

Let's encryptの設定方法

Centos 7系への設定方法

必要なツールをインストールする。
# yum install certbot certbot-apache

SSLのポートを開ける。
# sudo firewall-cmd --add-port=443/tcp --zone=public
# sudo firewall-cmd --add-port=443/tcp --zone=public --permanent

サーバ証明書を要求する。
バーチャルドメインの1と2のサーバ証明書がssl.confに自動で追加される。
# sudo certbot run --apache -d ドメイン1 -d ドメイン2

Webサーバを再起動する。
# systemctl restart httpd

下記のコマンドでサーバ証明書の更新ができる。
2カ月に1回自動で実行させる。
10 0 * 2,4,6,8,10,12 * certbot renew

Centos 6系への設定方法

必要なツールをインストールする。

# yum install git
# mkdir /opt; cd /opt
# git clone https://github.com/certbot/certbot
# cd certbot/
# ./certbot-auto  --debug

SSL証明書のみ作成

ドメイン:yyyy.xxxx.co.jp ルートディレクトリ:/var/www/html メールアドレス:pmadmin@…

# ./certbot-auto certonly --non-interactive --agree-tos --webroot -w /var/www/html -d yyyy.xxxx.co.jp --email pmadmin@xxxx.co.jp

下記の場所に証明書ファイルが作成される。
#  ls -l /etc/letsencrypt/live/yyyy.xxxx.co.jp/
#  ls -l /etc/letsencrypt/archive/yyyy.xxxx.co.jp/  <-- 実態はこちら

証明書の設定を行います。下記はhttpd.confに追加する場合の例

<VirtualHost *:443>
    ServerAdmin t.nagae@xxxx.co.jp
    ServerName yyyy.xxxx.co.jp
    ProxyPreserveHost On
    ProxyPass /.well-known !
    ProxyPass        /   http://192.168.25.70:8080/
    ProxyPassReverse /   http://192.168.25.70:8080/
    CustomLog      logs/yyyy_access.log common
    ErrorLog       logs/yyyy_error.log
    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/letsencrypt/live/yyyy.xxxx.co.jp/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/yyyy.xxxx.co.jp/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/yyyy.xxxx.co.jp/chain.pem
</VirtualHost>

Webサーバを再起動する。

# /etc/init.d/httpd restart  

下記のコマンドでサーバ証明書の更新ができる。
2カ月に1回自動で実行させる。
10 0 * 2,4,6,8,10,12 * /opt/letsencrypt/certbot/certbot-auto renew --force-renew ; && service httpd22 reload
Last modified 7 years ago Last modified on Feb 20, 2017, 4:28:37 PM
Note: See TracWiki for help on using the wiki.