流浪汉的麻烦-"404-找不到" [英] Trouble with Vagrant - "404 - Not Found"
问题描述
我正在尝试使用Vagrant制作LAMP盒子.有人告诉我,使用起来很简单.我是网络和虚拟机的新手,对Linux/Ubuntu的经验很少.我目前尝试按照官方文档页面上的教程进行操作: http://docs. vagrantup.com/v2/getting-started/networking.html .
I am attempting to make a LAMP box using Vagrant. I have been told that it is quite simple to use. I am completely new to networks and virtual machines and have very little experience with Linux/Ubuntu. I have currently tried following the tutorial on the official documentation page: http://docs.vagrantup.com/v2/getting-started/networking.html.
我已经阅读了文档中的网络文章,并且似乎无法正常工作.
I have gotten up to the networking article in the documentation and can't seem to get it working.
现在的问题是,由于我对基于网络和基于Linux的操作系统缺乏经验,所以我不知道从哪里开始解决问题.我将尽力提供尽可能多的信息.
Now the problem is, due to my inexperience with networking and linux based OS's I have no idea where to begin trouble shooting. I will try to give as much information I can.
我正在使用Windows 8.1运行最新版本的Vagrant和Virtualbox的最新版本.
I'm running the latest version of Vagrant with the latest version of Virtualbox with Windows 8.1.
根据教程,我当前的Vagrantfile如下所示:
As per the tutorial, my current Vagrantfile looks like this:
Vagrant.configure(2) do |config|
config.vm.box = "hashicorp/precise32"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network :forwarded_port, host: 4567, guest: 80
end
我的bootstrap.sh文件如下:
My bootstrap.sh file looks like this:
#!/usr/bin/env bash
apt-get update
apt-get install -y apache2
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -f /vagrant /var/www
fi
当我转到 http://127.0.0.1:4567 时,它显示了一个包含此消息的错误页面:
When I went to http://127.0.0.1:4567, it displayed an error page containing this message:
Not Found
The requested URL / was not found on this server.
===================================================
Apache/2.2.22 (Ubuntu) Server at 127.0.0.1 Port 4567
我宁愿不编辑任何配置文件,除非有解释,否则我认为这是一种解决方法.但是无论如何,任何帮助将不胜感激.如果需要打开端口,那么在考虑使用XAMPP时该如何做?
I would rather not edit any config files, unless there was an explanation, as I feel that would be a workaround. But regardless, ANY help would be appreciated. If I need to open up a port, then how do I'm at the point where I'm just considering using XAMPP.
推荐答案
我遇到了同样的问题.我尝试从无业游民的盒子中重新启动apache,我在终端上收到以下警告.
I had same problem. I tried to restart apache from the vagrant box, I got following warning on my terminal.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo service apache2 restart
* Restarting web server apache2
AH00112: Warning: DocumentRoot [/var/www/html] does not exist
AH00558: apache2: Could not reliably determine the server's fully qualified
domain name, using 10.0.2.15. Set the 'ServerName' directive globally to suppress this message
通过创建名为/var/www/html
这篇关于流浪汉的麻烦-"404-找不到"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!