在流浪汉中从浏览器访问网站

时间:2015-11-25 12:12:14

标签: vagrant vagrantfile vagrant-windows

在Windows 10上我运行了我的流浪汉然后成功地进入我的vm。已安装apache2 php5-cli php5 libapache2-mod-php

现在当我访问localhost:8080时,它显示的是apache默认欢迎页面。如何在浏览器中访问我的网站?

以下是我的Vagrantfile的内容

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "ubuntu/trusty64"

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  config.vm.network "forwarded_port", guest: 80, host: 8080
end

这是我目前的目录结构 enter image description here

1 个答案:

答案 0 :(得分:1)

您需要将数据导入VM并配置Apache以提供该数据。对于初学者,请将此添加到Vagrantfile(confiv.vm.network行之后):

config.vm.synced_folder ".", "/var/www/html"

它会使您的app文件夹在VM上的/var/www/html下可用。默认情况下,Ubuntu上的Apache从该文件夹提供服务,因此您应该在执行vagrant reload之后看到一些内容。

相关问题