我能够访问本地计算机中的子域,如下test.localhost
但我需要test.myMachineName
或test.myMachineIp
才能从我自己网络中的另一台计算机访问
我在本地wamp服务器中设置了子域,如下所示:
在https-vhost.conf中:
<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
#ErrorLog "logs/dummy-host.example.com-error.log"
#CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/wamp/www/test"
ServerName localhost
ServerAlias test.localhost
#ErrorLog "logs/dummy-host.example.com-error.log"
#CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
127.0.0.1 test.localhost
答案 0 :(得分:1)
我不明白你的配置。首先,如果您从另一台计算机访问test.localhost将无法正常工作,因为该计算机上不存在您的网站。您必须在路由器设置中使用IP地址和端口转发(专用IP:计算机本地IP,类型:TCP,范围:80 - 80)。
在 https-vhost.conf :
中<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
#ErrorLog "logs/dummy-host.example.com-error.log"
#CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/wamp/www/test"
ServerName test.youripaddress
ServerAlias test.youripaddress
#ErrorLog "logs/dummy-host.example.com-error.log"
#CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
在 HOST 文件中:
127.0.0.1 localhost
youripaddress test.youripaddress
问我任何问题。