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

Version 2 (modified by admin, 7 years ago) ( diff )

--

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証明書のみ作成

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

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

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

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

<VirtualHost *:443>
    ServerAdmin t.nagae@betasoft.co.jp
    ServerName kstep.betasoft.co.jp
    ProxyPreserveHost On
    ProxyPass /.well-known !
    ProxyPass        /   http://192.168.25.70:8080/
    ProxyPassReverse /   http://192.168.25.70:8080/
    CustomLog      logs/kstep_access.log common
    ErrorLog       logs/kstep_error.log
    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/letsencrypt/live/kstep.betasoft.co.jp/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/kstep.betasoft.co.jp/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/kstep.betasoft.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
Note: See TracWiki for help on using the wiki.