-1

I've been able to setup a number of local servers using different boxes; laravel/homestead & ubuntu/xenial64. These seem to spin up fine and when I run vagrant shh I can connect to the server without any issue. It even seems to be syncing the folder as expected into the /vagrant directory.

But when I try to load this (http://127.0.0.1/) into the browser, I just receive a "This site can’t be reached" error in Chrome.

By default the Vagrantfile looks like this:

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
end

I've previously been using Mamp Pro (which is still installed but not active) on my macOS High Sierra machine. So I don't think there is any port conflicts or anything like that.

But in case this is the issue, I have tried setting up a specific IP address like so

config.vm.network "private_network", ip: "55.55.55.5"

I've also tried defining different ports for the host

config.vm.network "forwarded_port", guest: 80, host: 4567, host_ip: "127.0.0.1"

I must be missing something in the configuration, but according to the documentation this should work. Any suggestions?

Just FYI, I've installed VirtualBox and Vagrant (using Homebrew) and am using Vagrant Manager to oversee the boxes.

Sheixt
  • 2,546
  • 12
  • 36
  • 65
  • If I setup a `scotch/box` VM following their docs, that works fine... I've (somewhat blindly) tried to mimic the `Vagrantfile` configuration and this doesn't work on any other boxes (e.g. `ubuntu/xenial64`). – Sheixt Jun 02 '18 at 13:14
  • Why do you think `http://127.0.0.1/` should respond? – techraf Jun 02 '18 at 15:35
  • Because in the docs when setting a new host port (to `4567`) the URL is `http://127.0.0.1:4567` – Sheixt Jun 03 '18 at 11:07
  • I'm not fussed what IP should go in the URL... Just wanna see it working lol – Sheixt Jun 03 '18 at 11:08

1 Answers1

1

You've just installed default ubuntu OS.

You dont have a web server running .. You can install Apache or nginx, and make sure you start the server, then only after that you can access it.

The scotch/box vagrant VM has a set of provisionner that installs all the server for you hence this is running fine.

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
  • Oh wow... what an oversight! With this in mind is Scotch a good box to start with, or are there others that are recommended? – Sheixt Jun 05 '18 at 13:31
  • As an after thought... would the case have been the same with `laravel/homestead` just I had the same issue there? And given it's popularity I'd assume this will have Apache (etc) installed – Sheixt Jun 05 '18 at 13:32
  • Right ˋlaravel/homestead` would work ootb as web server is installed on VM – Frederic Henri Jun 05 '18 at 19:26
  • Is the a specific port configuration that needs to be defined then? Just on the default `vagrant init` setup, I experience the same issue as with `ubuntu/xenial64` – Sheixt Jun 08 '18 at 07:43