はじめに
少しつまずいたので個人的にメモします。
前提条件
- OSはCentOS6系
- WEBサーバはapache、起動しておくこと
- gitインストール済
- DNSによるAレコード設定が完了していること
手順
- ホームディレクトリへ移動
command
$ cd ~
- gitからcertbotをダウンロード
command
$ git clone https://github.com/certbot/certbot`
- ダウンロードしたフォルダ内でテスト実行
command
$ cd certbot
$ sudo ./certbot-auto –debug
- 証明書発行
command
$ sudo ./certbot-auto certonly --webroot -w /path/to/Documentroot -d example.com -m example@example.com --renew-by-default --agree-tos --debug
-wはドキュメントルート。
-dはFQDN。
-mは通知用メールアドレス。
--renew-by-defaultはSSL/TLS サーバ証明書が既に存在する場合には、残りの有効期間にかかわらず、証明書を更新。
--debugはエラー時のtracebackを表示。
注)Basic認証を掛けている場合ドキュメントルート配下の.well-know配下に.htaccessを追加する
.htaccess
Satisfy any
order allow,deny
allow from all
- apache再起動
command
$ sudo service httpd restart
- 自動更新のためcron設定
毎月1日1時に更新
crontab
0 1 1 * * root /home/user/certbot/certbot-auto renew –force-renew && service httpd reload
参考