[root@ufuso ~]# cd /etc/pki/tls/certs/ ← ディレクトリ移動
[root@ufuso certs]# sed -i 's/365/3650/g' Makefile ← サーバー用証明書有効期限を1年から10年に変更
[root@ufuso certs]# make server.crt ← サーバー用秘密鍵の作成
umask 77 ;
/usr/bin/openssl genrsa -aes128 2048 > server.key
Generating RSA private key, 2048 bit long modulus
...........+++
.................................+++
e is 65537 (0x10001)
Enter pass phrase: ← パスワードの作成入力※表示はされない
Verifying - Enter pass phrase: ← 作成したパスワードを再入力※表示はされない
umask 77 ;
/usr/bin/openssl req -utf8 -new -key server.key -x509 -days 3650 -out server.crt -set_serial 0
Enter pass phrase for server.key: ← 作成したパスワードを再入力※表示はされない
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) [XX]:JP ← 国名応答
State or Province Name (full name) []:Okinawa ← 都道府県名応答
Locality Name (eg, city) [Default City]:Naha ← 市区町村名応答
Organization Name (eg, company) [Default Company Ltd]:ShikakiraCS ← 組織名が無ければドメイン名でも入力
Organizational Unit Name (eg, section) []: ← エンター・キーを押すだけ
Common Name (eg, your name or your server's hostname) []:ufuso.dip.jp ← ホストネーム=ドメイン名
Email Address []:webmaster@ufuso.dip.jp ← 管理者のメルアド
[root@ufuso certs]# openssl rsa -in server.key -out server.key ← サーバー用秘密鍵からパスワード削除
Enter pass phrase for server.key: ← 上記で応答したパスワードを応答※表示はされない
writing RSA key
[root@ufuso certs]# chmod 400 server.* ← アクセス不可設定
※パスワードを削除するのは、Webサーバー起動時にパスワードを要求されないようにするため
(2)SSL設定
[root@ufuso certs]# vi /etc/httpd/conf.d/ssl.conf ← ApacheSSL設定ファイル編集
# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html" ← #を削除(コメント解除)
↓
DocumentRoot "/var/www/html"
ServerName ufuso.dip.jp:443 ← #を削除(コメント解除)してホスト名を入力
# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A new
# certificate can be generated using the genkey(1) command.
#SSLCertificateFile /etc/pki/tls/certs/localhost.crt ← #を付けて
SSLCertificateFile /etc/pki/tls/certs/server.crt← サーバー用証明書を指定
# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
#SSLCertificateKeyFile /etc/pki/tls/private/localhost.key ← #を付けて
SSLCertificateKeyFile /etc/pki/tls/certs/server.key ← サーバー用秘密鍵を指定
■Apache設定反映
(1)Apache設定反映
[root@ufuso certs]# /etc/rc.d/init.d/httpd restart ← Apache再起動
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]