タイトル通りですが、さくら VPS (Debian squeeze) で無料 SSL 証明書 StartSSL を使ってみます。次のページのとても丁寧なガイドに従えば問題ありませんでした。
昨日、ここに書かれてあることをひと通り終えて、ほっと一息、眠りについたのですが、今朝 StartCom より次のようなメールが来ていました。
This mail is intended for the person who owns a digital certificate issued by the StartCom Certification Authority (http://www.startssl.com/).
It seems, that the installation of your server certificate with serial number xxxxxx for www.mysite.com is not complete! You should add the intermediate CA certificate to your installation. This is important, because most browsers will issue an error if this is not properly done. Please consult the installation instructions at http://www.startssl.com/?app=20 on how to do that. The missing CA certificate sub.class1.server.ca.pem can be obtained from http://www.startssl.com/certs/
「サーバーへの証明書のインストールが不完全ですよ。中間 CA 証明書を加えるべきで、それがないとたくさんのブラウザがエラーを返しますよ」とのことでした。
$ cd /etc/apache2/ssl $ sudo wget https://www.startssl.com/certs/sub.class1.server.ca.pem $ sudo wget https://www.startssl.com/certs/ca.pem
で証明書を入手しました。
/etc/apache2/site-available/mysite-ssl
の一部は次のようです。
<IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin postmaster@mysite.com DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/server.crt SSLCertificateKeyFile /etc/ssl/private/server.key SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem SSLCACertificateFile /etc/apache2/ssl/ca.pem </VirtualHost> </IfModule>
このサイト設定を有効にします。
$ a2ensite mysite-ssl
apache を再起動します。
$ /etc/init.d/apache2 restart
StartSSL の導入過程でパスフレーズ (10文字以上) を設定している場合、以下のようなメッセージが表示されます。
Restarting web server: apache2 ... waiting Apache/2.2.16 mod_ssl/2.2.16 (Pass Phrase Dialog) Some of your private key files are encrypted for security reasons. In order to read them you have to provide the pass phrases.
パスフレーズを正しく入力し再起動します。
サーバの起動時に毎度パスワード入力しなければなりませんので、秘密鍵からこのパスフレーズを削除したい場合には、
$ cd /etc/ssl/private $ sudo openssl rsa -in server.key -out server.key Enter pass phrase for server.key: xxxxxxxxxx writing RSA key
を実行しておきます。
Chrome でアクセスした様子。
“さくら VPS で無料 SSL 証明書 StartSSL を使う” への1件の返信