ローカルな ip ベース VirtualHost
ループバック ip アドレス(127.0.0.1 と 127.0.0.2) で
DocumentRoot を 2 つ持つ
OS
CentOS 6.5
lib
apache2
Implements
/etc/hots
127.0.0.1 localhost.localdomain localhost_hello 127.0.0.2 localhost.localdomain localhost_world ::1 localhost6.localdomain6 localhost6
- 初期設定の次項目を消す
- DocumentRoot
- Listen (IP) (初期設定かどうか忘れた)
- 次の項目を追加する
Listen 80 <VirtualHost 127.0.0.1> ServerAdmin root@locahost.example.local ServerName localhost_hello DocumentRoot /var/www/html_hello </VirtualHost> <VirtualHost 127.0.0.2> ServerAdmin root@locahost.example.local ServerName lolcahost_world DocumentRoot /var/www/html_world </VirtualHost>
- 適当な html ファイルをそれぞれの DocumentRoot に配置する
- つぎの URL 叩いて配置した html がブラウザに出力されればOK