Apache (VirtualHost) の設定
2011-01-23 Apache22によるVirtualHostの設定で設定した httpd-vhosts.conf を、IPv4 と IPv6 の共存(デュアルスタック)に書き換える。
httpd-vhosts.conf
バーチャルホストの設定変更。
Gateway Svr
IPv6 用のドキュメントルートを用意すると、アクセス確認がしやすい。
# cd /usr/local/etc/apache22/extra # vi httpd-vhosts.conf ### IPv4 ### <VirtualHost *:80> ServerAdmin info@EXAMPLE.com ServerName 192.168.X.1 DocumentRoot "/usr/local/www/apache2/data" </VirtualHost *:80> ### IPv6 ### <VirtualHost *:80> ServerAdmin info@EXAMPLE.com ServerName [200X:XXXX::1] DocumentRoot "/usr/local/www/apache2/data/data6" </VirtualHost *:80>
FOO.com
BAR.com, www.EXAMPLE.com の設定も IP アドレス以外は全て同じ。
### IPv4 ### <VirtualHost *:80> ServerAdmin info@EXAMPLE.com ServerName FOO.com ServerAlias www.FOO.com ProxyRequests Off <Proxy *> Order deny,allow Allow from All </Proxy> ProxyPass / http://192.168.X.2/ ProxyPassReverse / http://192.168.X.2/ ErrorLog "/var/log/FOO_proxy-error.log" CustomLog "/var/log/FOO_proxy-access.log" common </VirtualHost *:80> ### IPv6 ### <VirtualHost *:80> ServerAdmin info@EXAMPLE.com ServerName www6.FOO.com ProxyRequests Off <Proxy *> Order deny,allow Allow from All </Proxy> ProxyPass / http://[200X:XXXX::2]/ ProxyPassReverse / http://[200X:XXXX::2]/ ErrorLog "/var/log/FOO_proxy-error.log" CustomLog "/var/log/FOO_proxy-access.log" common </VirtualHost *:80>
設定の再読み込み
restart ではなく reload を使うこと。
# /usr/local/etc/rc.d/apache22 reload