バーチャルホストを構築する。用件は以下のように設定する
- IPベースのバーチャルホストで構築する
- 192.168.24.154 → cms.example1.jp に設定する
- SSL通信に対応する(証明書は事前に準備 本内容では作成方法には触れていないので注意)
- SSL3.0の脆弱性「POODLE」でSSL2.0, SSL3.0は無効にする
バーチャルホストのディレクトリ作成
cms.example1.jp
(1)ディレクトリ作成
# /var/www/vhost/cms/html # /var/www/vhost/cms/logs
(2)パーミッション変更
# chown apache:apache -R /var/www/vhost/cms
httpd.conf の編集
(1)http.conf のバックアップ
# cd /etc/httpd/conf # cp -p httpd.conf httpd.conf.20091008 # vi /etc/httpd/conf/httpd.conf
(2)httpd.conf の編集
以下を最終行に追記
# vi httpd.conf NameVirtualHost 192.168.24.154 <VirtualHost 192.168.24.154> ServerName cms.example1.jp DocumentRoot /var/www/vhost/cms/html ErrorLog /var/www/vhost/cms/logs/cms-error_log CustomLog /var/www/vhost/cms/logs/cms-access_log combined </VirtualHost>
Apache再起動
(1)構文チェック
# /etc/init.d/httpd configtest Syntax OK
(2)Apache再起動
# /etc/init.d/httpd restart httpd を停止中: [ OK ] httpd を起動中: [ OK ]
(3)http://cms.example1.jp にアクセスしてアクセス可能か確認する
バーチャルホストのディレクトリ作成(SSL対応)
SSLの証明書を事前に準備しておく事
(1)ssl.conf のバックアップ
# cd /etc/httpd/conf.d # cp -p ssl.conf ssl.conf.20091008
(2)ssl.conf の編集
# vi /etc/httpd/conf.d/ssl.conf
- 以下を最終行に追記
<VirtualHost 192.168.24.153:443>
ServerName cms.example1.jp:443
DocumentRoot /var/www/vhost/cms/html
ErrorLog /var/www/vhost/cms/logs/cms-ssl-error_log
TransferLog /var/www/vhost/cms/logs/cms-ssl-access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3 #SSL3.0の脆弱性「POODLE」で無効にしておく
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/httpd/vhost/cms/ssl_key/cert.pem
SSLCertificateKeyFile /etc/httpd/vhost/cms/ssl_key/key.pem
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog /var/www/vhost/cms/logs/cms-ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
Webサーバー設定反映(SSL対応)
(1)構文チェック
# /etc/init.d/httpd configtest Syntax OK
(2)Apache再起動
# /etc/init.d/httpd restart httpd を停止中: [ OK ] httpd を起動中: [ OK ]
(3)https://cms.example1.jp にアクセスしてアクセス可能か確認する


コメント