無料SSL letsencryptでHTTPS化する

先日

最近オープンベータで誰でも試せるようになった、無料で利用できるSSL証明書 Letsencryptを試した。

https://letsencrypt.org/

環境

  • Ubuntu14.04
  • Nginx
  • hhvm
  • wordpress

とどのつまるところここ https://www.laddy.info/

証明書取得の準備

Githubからセットアップ用のスクリプト取得


$ git clone https://github.com/letsencrypt/letsencrypt
$ cd letsencrypt/
$ ./letsencrypt-auto certonly -a standalone -d hoghoge.com
$ sudo ls /etc/letsencrypt/live/hoghoge.com
cert.pem chain.pem fullchain.pem privkey.pem

実行の際に作成する場所を聞かれるのでokと答えておく。

実行後に /etc/letsencrypt/live/hoghoge.com にpemファイル一式が出てきてる。

Nginx設定


server {
server_name hoghoge.com;
ssl on;
listen 443 ssl;

ssl_certificate /etc/letsencrypt/live/hoghoge.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hoghoge.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

root /var/www/default/;
index index.php index.html index.htm;

編集後 nginxを再起動させる。


$ sudo service nginx restart

そしてhttps://hogehoge.comへアクセスするとちゃんと表示されるはずです。。。