【Apache】1つのIPに複数のURLを【VirtualHost】
こんばんにちございます。トランです。
今日もメモ書きです。
Apacheという名前をご存知でしょうか?
httpdといえばピンとくる人もいるかもしれません。
そのApacheでVirtualHostを使ってみたメモ。
環境
OS:Windows7
Apache:XAMPP3.2.2にくっついてたやつ
ブラウザ:クローム
やったこと
①hostsに
127.0.0.1 htdocstest
を追加する。
②httpd.conf"のListen 80の下に
NameVirtualHost *:80
を追加
③httpd.conf"の中に
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
という記述があるか確認
④httpd-vhosts.confの中に
<VirtualHost *:80>
ServerAdmin htdocstest
DocumentRoot "C:/xampp/htdocstest"
ServerName htdocstest
</VirtualHost>
を追加
⑤httpd.confの中に
<Directory "C:/xampp/htdocstest">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
を追加
⑥C:/xampp/htdocstestというフォルダを作り
その中にHelloを表示させるindex.htmlを追加
⑦ブラウザでhttp://htdocstestをアドレスバーに入力エンター
そんなわけで、おしまい。