参考サイト)セキュアなWebサーバ(Apache+mod_ssl)の設定方法
参考サイト)OpenSSLのインストールとキーペアの生成
参考サイト)Linux サーバ奮闘記
Openssl,mod_sslは組み込んであるので設定のみとなる。
+++++Linux サーバ奮闘記参照++++++++++++
# openssl genrsa -out server_key.pem 1024
# openssl req -new -key server_key.pem -out server.csr
Enter pass phrase: 英数字のパスワード入力
Verifying - Enter pass phrase: 英数字のパスワード確認入力
Country Name (2 letter code) [GB]: JP(←適当に入力)
State or Province Name (full name) [Berkshire]: kyoto(←適当に入力)
Locality Name (eg, city) [Newnury]: kyoto(←適当に入力)
Organization Name (eg, company) [My Company Ltd]: yuyuyu(←適当に入力)
Organization Unit Name (eg, section) []: ayu(←適当に入力)
Common Name (eg, your name or your server's hostname) []: www.yuyuyu.jp(←適当に入力)
Email Address []: admin@yuyuyu.jp(←適当に入力)
A challenge password []: <Enterキーを押す>
An optional company name []: <Enterキーを押す>
# openssl x509 -req -in server.csr -signkey server_key.pem -out server.crt -days 365
# mv server_key.pem server.key
# cp server.crt /usr/local/apache2/conf/
# cp server.key /usr/local/apache2/conf/
Apache2のhttpd.confを編集する。
#vi /usr/local/apache2/conf/httpd.conf
#Include conf/extra/httpd-default.conf を以下の様に書き換える
・・・・・・・・・・・・・・・・・
# Secure (SSL/TLS) connections
Include conf/extra/httpd-myssl.conf
・・・・・・・・・・・・・・・・・
セキュアサイトを置くディレクトリを作成する。
# mkdir /usr/local/apache2/sslsite
# chown apache:apache /usr/local/apache2/sslsite
# chmod 777 /usr/local/apache2/sslsite
configファイルを作成する。
# vi /usr/local/apache2/conf/extra/httpd-myssl.conf
Listen 443
SSLSessionCache dbm:logs/ssl_scache
SSLSessionCacheTimeout 300
<VirtualHost 192.168.0.3:443>
ServerName yuyuyu.jp
ServerAdmin admin@yuyuyu.jp
DocumentRoot /usr/local/apache2/sslsite
SSLEngine on
SSLCertificateKeyFile conf/server.key
SSLCertificateFile conf/server.crt
</VirtualHost>
以上でSSLの設定は終わり。
参考サイト)OpenSSLのインストールとキーペアの生成
参考サイト)Linux サーバ奮闘記
Openssl,mod_sslは組み込んであるので設定のみとなる。
+++++Linux サーバ奮闘記参照++++++++++++
# openssl genrsa -out server_key.pem 1024
# openssl req -new -key server_key.pem -out server.csr
Enter pass phrase: 英数字のパスワード入力
Verifying - Enter pass phrase: 英数字のパスワード確認入力
Country Name (2 letter code) [GB]: JP(←適当に入力)
State or Province Name (full name) [Berkshire]: kyoto(←適当に入力)
Locality Name (eg, city) [Newnury]: kyoto(←適当に入力)
Organization Name (eg, company) [My Company Ltd]: yuyuyu(←適当に入力)
Organization Unit Name (eg, section) []: ayu(←適当に入力)
Common Name (eg, your name or your server's hostname) []: www.yuyuyu.jp(←適当に入力)
Email Address []: admin@yuyuyu.jp(←適当に入力)
A challenge password []: <Enterキーを押す>
An optional company name []: <Enterキーを押す>
# openssl x509 -req -in server.csr -signkey server_key.pem -out server.crt -days 365
# mv server_key.pem server.key
# cp server.crt /usr/local/apache2/conf/
# cp server.key /usr/local/apache2/conf/
Apache2のhttpd.confを編集する。
#vi /usr/local/apache2/conf/httpd.conf
#Include conf/extra/httpd-default.conf を以下の様に書き換える
・・・・・・・・・・・・・・・・・
# Secure (SSL/TLS) connections
Include conf/extra/httpd-myssl.conf
・・・・・・・・・・・・・・・・・
セキュアサイトを置くディレクトリを作成する。
# mkdir /usr/local/apache2/sslsite
# chown apache:apache /usr/local/apache2/sslsite
# chmod 777 /usr/local/apache2/sslsite
configファイルを作成する。
# vi /usr/local/apache2/conf/extra/httpd-myssl.conf
Listen 443
SSLSessionCache dbm:logs/ssl_scache
SSLSessionCacheTimeout 300
<VirtualHost 192.168.0.3:443>
ServerName yuyuyu.jp
ServerAdmin admin@yuyuyu.jp
DocumentRoot /usr/local/apache2/sslsite
SSLEngine on
SSLCertificateKeyFile conf/server.key
SSLCertificateFile conf/server.crt
</VirtualHost>
以上でSSLの設定は終わり。