wamp 用のマルチ サイトを作成しました。これはサーバー pc で正常に動作していますが、ネットワークからこれらのサイトにアクセスする方法がわかりません。すべてのサイトのフォルダーを、「www」の前のフォルダーである wamp のルートに配置しました。
これはApache confの一部です
#virtual sites
NameVirtualHost *:80
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:/wamp/www"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName client1.localhost
DocumentRoot "C:/wamp/client1"
<Directory "C:/wamp/client1">
allow from all
order allow,deny
AllowOverride All
Require all granted
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName client2.localhost
DocumentRoot "C:/wamp/client2"
<Directory "C:/wamp/client2">
allow from all
order allow,deny
AllowOverride All
Require all granted
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
ここにホストのエントリがあります
127.0.0.1 localhost
127.0.0.1 client1.localhost
127.0.0.1 client2.localhost
127.0.0.1 client3.localhost
これは、x.localhost (x = クライアント フォルダー) に移動することにより、サーバーの PC ブラウザーで正常に機能します。クライアント PC のホスト ファイルを次のように変更しました。
127.0.0.1 localhost
192.168.0.100 main
192.168.0.100 client1.main
192.168.0.100 client2.main
192.168.0.100 client3.main
クライアントのブラウザーでは、これらの URL はすべてメインの wampserver index.php を示し、割り当てられたフォルダー/サイトは示しません。