Seasons.NET

ちょっとした技術ブログです

VirtualHostをうまく使う

同じIPのサーバーでDocumentRootを異なる場所にしたい時。

Windows側

  • hostsファイルを書き換える
    • 192.168.100.222 seasons.fc6
    • 192.168.100.222 seasons.svn

てな感じで複数の名前を割り振っておく

そしたら、
httpd.condのほうは、以下のように修正しておく。

 1 NameVirtualHost *:80
 2 
 3 <VirtualHost *:80>
 4     ServerAdmin keisuke@hata.biz
 5     DocumentRoot "/usr/local/DEVEL"
 6     ServerName seasons.svn
 7     ErrorLog /home/seasons/svn/log/error_log
 8 </VirtualHost>
 9 
10 <VirtualHost *:80>
11     ServerAdmin keisuke@hata.biz
12     DocumentRoot "/var/www/html"
13     ServerName seasons.fc6
14     ErrorLog /home/seasons/svn/log/error_log
15 </VirtualHost>