如何访问虚拟电脑上的本地主机端口?
我已经下载并安装了 Microsoft Virtual PC 和 Windows XP 模式映像来测试 IE6。我在本地主机上有几个项目,可以通过 vhosts 文件中的端口号访问这些项目,例如:
Listen *:82
<VirtualHost *:82>
DocumentRoot "path/to/htdocs/project-folder/public/"
</VirtualHost>
在虚拟机中,我更改了主机文件,以便 http://mymachine
重定向到我的根本地主机目录(相当于http://localhost:80/
)。
如何设置虚拟机,以便 http://project-n/
转到正确的本地主机端口?可悲的是,http://mymachine:82/
并不能完成这项工作=(
I've downloaded and installed the Microsoft Virtual PC and Windows XP mode image for testing IE6. I have several projects on localhost that I access by port numbers in my vhosts file, for example:
Listen *:82
<VirtualHost *:82>
DocumentRoot "path/to/htdocs/project-folder/public/"
</VirtualHost>
In the virtual machine I have changed the hosts file so that http://mymachine
redirects to my root localhost directory (equivalent to http://localhost:80/
).
How do I set up the virtual machine so that http://project-n/
goes to the correct localhost port? And sadly, http://mymachine:82/
doesn't do the job =(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在虚拟计算机上,我在主机文件中添加了
其中的 x 是我的主机的 IP 地址。
在我的主机 httpd-vhosts.conf 文件中,我将 *:80 端口更改为 localhost:80。我不知道为什么会这样,但确实如此。
我的 httpd-vhosts.conf 文件现在看起来像:
现在,在虚拟 PC 中,当我转到 'http://project -n:81/' 它将加载项目-a,并且'http://project-n:82 ' 加载项目-b/public =D
On the virtual computer, in the hosts file I have added
where the x's are my host computer's ip address.
In my host computers httpd-vhosts.conf file I changed the *:80 port to localhost:80. I don't know why this works, just that it does.
My httpd-vhosts.conf file now looks like:
Now, in the virtual pc, when I goto 'http://project-n:81/' it will load project-a, and'http://project-n:82' loads project-b/public =D