Skip to content

Instantly share code, notes, and snippets.

@K-atc
Last active August 29, 2015 13:57
Show Gist options
  • Save K-atc/9800514 to your computer and use it in GitHub Desktop.
Save K-atc/9800514 to your computer and use it in GitHub Desktop.
Apache

Xampp

名前ベースの仮想ホスト

(参考:Apacheで仮想ホストを動かそう - @IT

  • apache\conf\exstra\httpd_vhosts.confで仮想ホストを設定

  • hostsファイルで仮想ホストのドメインを追加する

    • hostsファイルは、ホスト名とIPアドレスの対応を静的に定義しておくためのファイル

    • 通常は、ネームサーバの情報よりもhostsファイルの情報が優先されるため、テストなどで一時的に名前解決させたい場合などに便利

    • 場所:WindowsではC:/WINDOWS/system32/drivers/etc/hosts、UNIX系では/etc/hosts

    • 自分自身を表す「127.0.0.1」の行に、今回の仮想ホスト名(ここではvhost1とvhost2)を追加します

    127.0.0.1 cent53 localhost.localdomain localhost vhost1 vhost2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment