頻繁に触らないので、毎度毎度 hostsファイルはどこだっけ!ってなるのさ。
WindowsXP はココです。
C:\WINDOWS\system32\drivers\etc\hosts
hostsファイルは、ローカルマシンだけで、ドメイン → IPアドレス の解決をしてくれる、自分だけのDNSサーバーみたいなもんです。
ローカル開発環境の VirtualHostを Nameベースで接続出来たりるすので、管理が楽になります。
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
一度も触ったことが無ければ上のような感じ。
ただのテキストファイルだし、書式も簡単。
1行に、一対の IPアドレス と ドメイン を書くだけ。 # 以降はコメント。
自分で設定したいものを、この後に書き足すだけ。例えばこんな感じ。
#
# VMware Player
#
192.168.24.51 soundws.local
192.168.24.52 sound-uz.jp.local
192.168.24.53 beatnik.jp.local
#
# Apache2.2 + PHP5.3
#
127.0.10.1 test.local
127.0.10.2 sv001.local
httpプロトコルに限らず、FTPでもSSHでも、ルーターよりも先に、hosts を読みに行くので、使いどころは同一ネットワーク内に留めておくのが無難。ドメイン名も実在するものとかぶらないよう工夫が必要。