从虚拟机虚拟机寻址localhost(Addressing localhost from a VirtualBox virtual machine)

编程入门 行业动态 更新时间:2024-10-11 17:29:13
虚拟机虚拟机寻址localhost(Addressing localhost from a VirtualBox virtual machine)

我有一个本地的测试/开发服务器(当然是http),听8000端口,

我正在使用Linux,所以要测试IE6 / 7/8等页面,我运行虚拟机使用虚拟框; 我还需要看一下Windows环境中的firefox(例如,字体是不同的)。

在我的真实机器中,我使用URL http://localhost:8000打开网站,如何从虚拟机解决这个本地主机?

现在我的解决方法是使用IP地址。 任何更好的想法?

I have a local test/development server (HTTP, of course), listening to port 8000.

I'm working on Linux, so to test the page on Internet Explorer 6, 7, 8, etc. I run a virtual machine using VirtualBox; I also need to see how it look on Firefox in a windows environment (fonts for instance are different).

In my real machine, I open the website simply using the URL http://localhost:8000, how do I address this localhost from the virtual machine?

Right now my workaround is to use the IP address. Any better ideas?

最满意答案

谷歌转过来: http : //data.agaric.com/localhost-from-virtualbox-xp-install-ubuntu

它建议使用IP: http://10.0.2.2 : http://10.0.2.2 ,它对我http://10.0.2.2 。

所以,我编辑了主机文件C:\windows\system32\drivers\etc\hosts ,并添加了这个条目:

10.0.2.2 outer

如果您在IE8上进行测试,请记住将地址栏中的http:// 。 只要把ip直接放在ip上就行了。

例如:

http://10.0.2.2:3000/

Googling turned this up: http://data.agaric.com/localhost-from-virtualbox-xp-install-ubuntu

It suggests using IP: http://10.0.2.2, and it worked for me.

So, I edited the hosts file, C:\windows\system32\drivers\etc\hosts, and added this entry:

10.0.2.2 outer

If you're testing on IE8, remember to put http:// in the address bar. Just putting the ip directly will not work.

For example:

http://10.0.2.2:3000/

更多推荐

本文发布于:2023-07-14 19:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1106714.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:虚拟机   localhost   Addressing   machine   virtual

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!