問題を複数のバーチャルホストの設定
-
05-09-2019 - |
質問
詳細
- XAMPP1.7.1
- OSの動作確認はvista、xp
こんにちはます。しているのか教えてください問題設定を行っバーチャルホスト現在のとしています。
このバーチャルホスト.confファイル:
<VirtualHost *:80>
ServerAdmin me@site.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me@site.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
もちろん私のホストファイルにしていま
127.0.0.1 site1.local
127.0.0.1 site2.local
私はapacheを再起動に生かすことはもちろん各種ブラウザです。
ここでは私の問題:
http://site1.local ます。でに行った時に http://site2.local, い土地でsite1.します。
うのでしょうか。
解決
試してみてください。
<VirtualHost "site1.local">
ServerAdmin spam@a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost "site2.local">
ServerAdmin spam@a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
あなたは常に最初にApacheのデフォルトのためSITE1を取得します。
編集
のコメントを外し
#NameVirtualHost *
タグに
NameVirtualHost *
あなたのhttpd.confの
鉱山は(ある/etc/httpd/conf/httpd.conf)
と言います126 # Listen: Allows you to bind Apache to specific IP addresses and/or
127 # ports, in addition to the default. See also the <VirtualHost>
128 # directive.
129 #
130 # Change this to Listen on specific IP addresses as shown below to
131 # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
132 #
133 Listen 127.0.0.1:80
134 NameVirtualHost 127.0.0.1
そして、私のバーチャルホストのファイルがあります。
<VirtualHost "www.whatever.com">
DocumentRoot /var/www/html/whatever/pub
ErrorLog logs/error_log
ServerName www.whatever.com
...
所属していません StackOverflow