Windows 10 上的 Vagrant Apache 安装
Vagrant Apache setup on Windows 10
我很难让 Vag运行t 在 Windows10 上工作。这是我到目前为止所做的:
- 已安装 Git 2.7.4
- 已安装 VirtualBox 5.0.16
- 已安装 Vag运行t 1.8.1
我想要一个预配置的 Apache / PHP 框,所以我使用 'Scotch Box' (https://github.com/scotch-io/scotch-box)。我已经从 Git Bash 提示符中克隆了 repo 和 运行 vagrant up
。
这成功创建并启动了 VM,但是在此过程中出现了一些错误:
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.0.16
Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
在此之后我 运行 vagrant ssh
,这向我展示了 Ubuntu 介绍屏幕。
然后我尝试按照建议在浏览器中访问 IP 地址 http://192.168.33.10
。但是,这只会显示一个 404 Not Found
页面。然后我在 VM 中 运行 curl localhost:80
,这也输出相同的 404 页面。
究竟是怎么回事,我该如何进一步诊断?我不太熟悉 Unix,所以需要一些帮助。
您在问题中列出的错误:
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.0.16
Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
实际上是来自 Vagrant 插件,vagrant-vbguest
根据我的经验 - 它试图将您的 Guest Additions 版本与您的 virtualbox 版本相匹配。通常是无害的。
关于你的问题,我每周都会看到一些关于人们对 scotchbox 有疑问的问题。如果您只需要 apache2 和 php5,为什么不直接初始化一个可信赖的盒子并安装 apache2 和 php5 软件包呢?
vagrant init ubuntu/trusty64
将以下内容添加到您的 Vagrantfile
中:
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y apache2 php5
SHELL
您还需要在 Vagrantfile
中启用网络类型,以便您可以从主机(和浏览器)访问该框。从生成的 Vagrantfile
:
中选择以下一项 UNCOMMENT(删除 #
)
# config.vm.network "private_network", ip: "192.168.33.10"
或
# config.vm.network "forwarded_port", guest: 80, host: 8080
运行 vagrant up
并且您可以在 http://192.168.33.10
或 http://localhost:8080
访问您的网络服务器,具体取决于您选择的网络选项。
我在谷歌搜索后发现了问题所在。
我查看了 /etc/apache2/sites-available
目录中的 000-default.conf
文件。在这里它有 DocumentRoot
设置为 /var/www/public
.
所以我所要做的就是在我的主机上创建一个名为 public
的新文件夹,并将我所有的网站文件放在那里。
我很难让 Vag运行t 在 Windows10 上工作。这是我到目前为止所做的:
- 已安装 Git 2.7.4
- 已安装 VirtualBox 5.0.16
- 已安装 Vag运行t 1.8.1
我想要一个预配置的 Apache / PHP 框,所以我使用 'Scotch Box' (https://github.com/scotch-io/scotch-box)。我已经从 Git Bash 提示符中克隆了 repo 和 运行 vagrant up
。
这成功创建并启动了 VM,但是在此过程中出现了一些错误:
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.0.16
Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
在此之后我 运行 vagrant ssh
,这向我展示了 Ubuntu 介绍屏幕。
然后我尝试按照建议在浏览器中访问 IP 地址 http://192.168.33.10
。但是,这只会显示一个 404 Not Found
页面。然后我在 VM 中 运行 curl localhost:80
,这也输出相同的 404 页面。
究竟是怎么回事,我该如何进一步诊断?我不太熟悉 Unix,所以需要一些帮助。
您在问题中列出的错误:
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.0.16
Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
实际上是来自 Vagrant 插件,vagrant-vbguest
根据我的经验 - 它试图将您的 Guest Additions 版本与您的 virtualbox 版本相匹配。通常是无害的。
关于你的问题,我每周都会看到一些关于人们对 scotchbox 有疑问的问题。如果您只需要 apache2 和 php5,为什么不直接初始化一个可信赖的盒子并安装 apache2 和 php5 软件包呢?
vagrant init ubuntu/trusty64
将以下内容添加到您的 Vagrantfile
中:
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y apache2 php5
SHELL
您还需要在 Vagrantfile
中启用网络类型,以便您可以从主机(和浏览器)访问该框。从生成的 Vagrantfile
:
#
)
# config.vm.network "private_network", ip: "192.168.33.10"
或
# config.vm.network "forwarded_port", guest: 80, host: 8080
运行 vagrant up
并且您可以在 http://192.168.33.10
或 http://localhost:8080
访问您的网络服务器,具体取决于您选择的网络选项。
我在谷歌搜索后发现了问题所在。
我查看了 /etc/apache2/sites-available
目录中的 000-default.conf
文件。在这里它有 DocumentRoot
设置为 /var/www/public
.
所以我所要做的就是在我的主机上创建一个名为 public
的新文件夹,并将我所有的网站文件放在那里。