从虚拟服务器访问主机上的 Wiki 安装

从虚拟服务器访问主机上的 Wiki 安装

最近我在 VirtualBox 中的 Ubuntu Server 上设置了 Dokuwiki 安装。我的主机操作系统是 Ubuntu 11.10。到目前为止,我一直在为我的 VirtualBox 使用 NAT 配置。从今天起,我决定使用仅主机网络,因为我不想让 wiki 访问外部世界。当我使用 NAT 方法时,我可以使用以下 URL 访问我的 wiki:http://localhost:8080/dokuwiki/doku.php。然而,当我切换到仅主机方式后,我就无法做到这一点。

在其他地方看到说明后,我意识到使用http://192.168.56.101/dokuwiki/doku.php有帮助,但对我没有帮助。正如这里所指示的,我如何从主机访问 Apache(在 VirtualBox 客户机上)?我尝试将以下行添加到我的主机文件中

192.168.56.101 用户

使用的想法http://userver/dokuwiki/doku.php访问我的网站。即使http://192.168.56.101/dokuwiki/doku.php没有用。那么有人能帮助我解决这个问题吗?

使用 URL 中的 IP 地址访问是可以的,但我想知道如何设置自定义域名以供使用。

更新:根据 RK 的建议,我重启了虚拟机和物理机。然后我发现在连接到互联网之前,wiki 可以通过以下方式访问:http://192.168.56.101/dokuwiki/doku.php或者http://userver/dokuwiki/doku.php。一旦我使用我的 USB 加密狗(我用)连接到网络,wvdialwiki 就变得无法访问。

答案1

您必须手动设置虚拟机的 IP 或激活 VB 的 dhcp 服务器。从文档

For host-only networking, like with internal networking, you may find the DHCP
server useful that is built into VirtualBox. This can be enabled to then 
manage the IP addresses in the host-only network since otherwise you would 
need to configure all IP addresses statically.

相关内容