Changes between Version 1 and Version 2 of Let's encrypt設定方法(CentOS)


Ignore:
Timestamp:
Feb 20, 2017, 4:25:41 PM (7 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Let's encrypt設定方法(CentOS)

    v1 v2  
     1=  Let's encryptの設定方法 =
     2
     3== Centos 7系への設定方法 ==
    14
    25{{{
     6必要なツールをインストールする。
     7# yum install certbot certbot-apache
    38
     9SSLのポートを開ける。
     10# sudo firewall-cmd --add-port=443/tcp --zone=public
     11# sudo firewall-cmd --add-port=443/tcp --zone=public --permanent
    412
    5 yum install -y git openssl mod_ssl
    6 git clone https://github.com/letsencrypt/letsencrypt
     13サーバ証明書を要求する。
     14バーチャルドメインの1と2のサーバ証明書がssl.confに自動で追加される。
     15# sudo certbot run --apache -d ドメイン1 -d ドメイン2
    716
     17Webサーバを再起動する。
     18# systemctl restart httpd
    819
     20下記のコマンドでサーバ証明書の更新ができる。
     212カ月に1回自動で実行させる。
     2210 0 * 2,4,6,8,10,12 * certbot renew
    923}}}
    1024
    1125
    12 == CentOS 7 の場合 ==
     26== Centos 6系への設定方法 ==
     27
     28必要なツールをインストールする。
    1329
    1430{{{
    15 yum install certbot certbot-apache
    16 sudo firewall-cmd --add-port=443/tcp --zone=public
    17 sudo firewall-cmd --add-port=443/tcp --zone=public --permanent
     31# yum install git
     32# mkdir /opt; cd /opt
     33# git clone https://github.com/certbot/certbot
     34# cd certbot/
     35# ./certbot-auto  --debug
     36}}}
    1837
    19 sudo certbot run --apache -d ドメイン1 -d ドメイン2
    2038
    21 バーチャルドメインの1と2のサーバ証明書がssl.confに自動で追加される。
     39== SSL証明書のみ作成 ==
     40
     41ドメイン:kstep.betasoft.co.jp
     42ルートディレクトリ:/var/www/html
     43メールアドレス:pmadmin@betasoft.co.jp
     44
     45{{{
     46# ./certbot-auto certonly --non-interactive --agree-tos --webroot -w /var/www/html -d kstep.betasoft.co.jp --email pmadmin@betasoft.co.jp
     47
     48下記の場所に証明書ファイルが作成される。
     49#  ls -l /etc/letsencrypt/live/kstep.betasoft.co.jp/
     50#  ls -l /etc/letsencrypt/archive/kstep.betasoft.co.jp/  <-- 実態はこちら
     51}}}
     52
     53
     54
     55証明書の設定を行います。下記はhttpd.confに追加する場合の例
     56
     57{{{
     58<VirtualHost *:443>
     59    ServerAdmin t.nagae@betasoft.co.jp
     60    ServerName kstep.betasoft.co.jp
     61    ProxyPreserveHost On
     62    ProxyPass /.well-known !
     63    ProxyPass        /   http://192.168.25.70:8080/
     64    ProxyPassReverse /   http://192.168.25.70:8080/
     65    CustomLog      logs/kstep_access.log common
     66    ErrorLog       logs/kstep_error.log
     67    SSLEngine on
     68    SSLProtocol all -SSLv2
     69    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
     70    SSLCertificateFile /etc/letsencrypt/live/kstep.betasoft.co.jp/cert.pem
     71    SSLCertificateKeyFile /etc/letsencrypt/live/kstep.betasoft.co.jp/privkey.pem
     72    SSLCertificateChainFile /etc/letsencrypt/live/kstep.betasoft.co.jp/chain.pem
     73</VirtualHost>
     74}}}
     75
     76
     77Webサーバを再起動する。
     78
     79{{{
     80# /etc/init.d/httpd restart 
    2281
    2382下記のコマンドでサーバ証明書の更新ができる。
    24832カ月に1回自動で実行させる。
    25 sudo certbot renew
    26 
     8410 0 * 2,4,6,8,10,12 * /opt/letsencrypt/certbot/certbot-auto renew --force-renew ; && service httpd22 reload
    2785}}}