从本地虚拟机访问虚拟主机

发布于 2025-01-04 07:46:42 字数 545 浏览 4 评论 0原文

我有一个名为 project 的虚拟主机,因此在我的本地主机中我访问 http://project ,一切正常,网络服务器位于 Apache 2.2 中乌班图11.04。然后我需要在 Safari 和 IE 上测试这个项目,我在同一台计算机上有一个装有 Windows XP 的虚拟机(使用 VirtualBox)。

如何从虚拟机访问我的虚拟主机?我已经在虚拟机中的 IE 中尝试过 http://project 但没有成功。我可以尝试 http://192.168.1.20/project (我的本地IP)它可以工作,但我真的需要访问使用虚拟主机名(http://project),因为很多代码和重写规则仅在我使用 http://project 时才起作用

谢谢

I have a virtualhost called project so in my localhost I access http://project and everything is ok, the webserver is in Apache 2.2 in Ubuntu 11.04. Then I need to test this project on Safari and IE, I have a Virtual Machine with Windows XP in the same computer (using VirtualBox).

How can I access to my virtualhost from the virtual machine? I've tried http://project from IE in the virtual machine and it didn't work. I could try http://192.168.1.20/project (my local ip) it work but I really need to access with the virtualhost name (http://project) because a lot of code and rewrite rules only work when I use http://project

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

就此别过 2025-01-11 07:46:42

作为管理员,在 XP 虚拟机上编辑 C:\Windows\System32\drivers\etc\hosts 并添加以下行;

192.168.1.20 project

之后,您应该能够通过主机名访问它。

As an administrator, edit C:\Windows\System32\drivers\etc\hosts on your XP virtual machine and add the line;

192.168.1.20 project

After that, you should be able to access it by host name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文