TITLE:Apacheへのmod_sslの設定
*Apacheへのmod_sslの設定 [#u50b63b0]
あまりお勧めではないが、
通称「オレオレ証明書」でSSLを使った暗号化通信ができるようにする。
**サーバの秘密鍵の作成 [#l1e97f7c]
適当なパスフレーズを入力して、秘密鍵を作成する。
# cd /etc/pki/tls/certs
# make server.key
あと、このままだとサーバの再起動時に、パスフレーズの入力が必要になる。
そこで、次のようにして、パスフレーズを入力しなくてもいいようにする。
# openssl rsa -in server.key -out server.key
**サーバ用証明書の作成 [#d5249132]
ここで「オレオレ証明書」を作成する(汗)
# make server.crt
umask 77 ; \
/usr/bin/openssl req -utf8 -new -key server.key -x509 -days 365 -out
server.crt -set_serial 0
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Hyogo
Locality Name (eg, city) [Newbury]:Kakogawa
Organization Name (eg, company) [My Company Ltd]:Hoge Ltd
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:hogehoge.hoge.ac.jp
Email Address []:webmaster@hogehoge.hoge.ac.jp
証明書の有効期限を延ばす(この場合は10年)。
# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
**SSLの設定 [#l79a7058]
設定ファイルに、作成した秘密鍵と証明書を設定する。
# vi /etc/httpd/conf.d/ssl.conf
内容は次のとおり。
DocumentRoot "/var/www/html" ←コメントを削除
...
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/certs/server.key
**サーバを再起動 [#a50cc788]
設定を反映させるため、サーバを再起動する。
# service httpd restart
***参考 [#b679cd45]
-http://centossrv.com/apache-ssl.shtml
-http://www.server-world.info/query?os=CentOS_6&p=ssl
|