如何从虚拟机连接到本地主机?
我正在我的 PC 上使用 VMware 工作站(使用 win 7)运行一些虚拟机,而且我正在使用基本的 WAMP 安装。我正在尝试从任何虚拟机连接到我的 Win7 Apache 服务器。我尝试更改 httpd.conf 文件中的以下行:
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all ## Was Deny from all
Allow from 127.0.0.1
</Directory>
这样,如果我进入 VM 浏览器并输入“http://my-ip/Project”,我可以打开该项目,但看不到图像或 css样式,我认为我在某处缺少一些权限,而且我也不认为允许所有人是执行此操作的最安全方法。
有谁知道我应该怎么做?
提前致谢!
I'm running some virtual machines using VMware workstation on my PC (using win 7), also I'm using a basic WAMP installation. I'm trying to connect to my Win7 Apache server from any of the VMs. I tried changing the following line on my httpd.conf file:
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all ## Was Deny from all
Allow from 127.0.0.1
</Directory>
This way if I go into my VM browser and type "http://my-ip/Project" I can open the project but I can't see the images or css styles, I think I'm missing some permissions somewhere, also I don't think allowing from all is the most secure way of doing this.
Does anyone know how should I do this?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将虚拟机的 NAT 地址应用于 httpd.conf 中的“Allow from”子句。 127.0.0.1 指的是您的本地主机。就 Apache 而言,虚拟机不是本地主机的。它们是虚拟网络上的 PC。
Apply the NAT addresses of the VMs to the "Allow from" clause in httpd.conf. 127.0.0.1 refers to your localhost. The VMs are not localhost's as far as Apache is concerned. They're PCs on a virtual network.