hostsファイルの追加
macのローカル環境にホスト名指定でlocalhostにアクセスしたいっていう状況が生まれて、設定してみた。
こういうことをやっていると、パソコンのいろいろ原理的なものがわかってくるような気がして面白い。
hostsファイル
これは、macの場合は/etc/hosts。これを下記のように追加するだけ。
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 xxx
その後に、下記コマンドをやる。DNSキャッシュの解消だ。
dscacheutil -flushcache