首先禁用 IIS,因为它使用端口 80,这与 VM 内的 apache 使用的端口相同。
其次查看 NAT 配置并确保您从 VM 导出端口 80 作为主机的端口 80。
第三,您可能想使用Vagrant
它,它是一个 VirtualBox 命令行 VM 管理器,有很多花里胡哨。如果您想尝试Vagrant
,我会发布一个Vagrantfile
,这样您就可以快速开始。
流浪文件
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Specify the virtual machine base box file. This box file
# is actually a compressed VMDK file with some aditional
# settings.
# The one specified here is a default Ubuntu Lucid Lynx
# 32bit install but you can find many others online. The url is
# external (HTTP) because Vagrant cand download this box if you
# don't already have it
config.vm.box = "MyVM"
config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
# Tells VirtualBox to not open a GUI, it helps you avoid
# having a window for VirtualBox and another window for the VM.
# For server management windows are not necessary you can
# connect to the VM using SSH (putty for example).
config.vm.boot_mode = :headless
# In this section every pair of parameters is a VBoxManage
# parameter/value configuration.
config.vm.customize [
"modifyvm", :id,
# Specify the virtual machine name you want to see in
# VirtualBox
"--name", "MyVM",
# Memory for the VM
"--memory", "2048",
# This fixes a bug that makes the guest not have DNS
# proper access and implicitly not internet.
"--natdnsproxy1", "on",
"--natdnshostresolver1", "on"
]
# This forwards port 80 to port 4567
config.vm.forward_port 80, 4567
# This mounts a shared folder between your machine and the
# VM. The host directory is the current working directory (the
# one you have put your Vagrantfile in). The directory is
# mounted inside the guest as /vagrant
config.vm.share_folder "v-root", "/vagrant", "."
end