6

I tried to install Vagrant and Ubuntu on mac os 10.9.4 to make a local development server following this great instructions by @fideloper: Vagrant and Apache.

the Vagrantfile contains:

config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.synced_folder ".", "/var/www/html"

evreything worked fine during the process: Vagrant and virtualbox are installed, Apache is installed on the guest.

from this answer, i tried:

  • on the guest, curl 'http://localhost:80' returns an html with a file listing
  • on the host, curl -v 'http://localhost:8080' returns the same page.

but the browser says this webpage is not available at localhost:8080.

why the browser is not displaying localhost:8080?

Community
  • 1
  • 1
François Romain
  • 13,617
  • 17
  • 89
  • 123

1 Answers1

5

The setting:

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

will overwrite whatever's in the server's /var/www/html directory with whatever is in your host machine's "." directory (the shared directory).

There's no longer Apache's default index.html file at /var/www/html/index.html because you mounted your shared directory at that location in the Vagrant synced_folder settings.

From what you're saying, it's working totally normally and you can just start adding your own .html files into your shared folder and go! You just don't have a .html file in your shared directory to serve, so Apache's falling back to showing the index of the files there.

fideloper
  • 12,213
  • 1
  • 41
  • 38
  • Everything works normally except the browser says `this webpage is not available` and doesn't show anything, even if there are some html files inside the folder… – François Romain Jul 27 '14 at 17:20
  • And suddenly it's working !!! I just vagrant reloaded many times since yesterday… and for no apparent reason it suddenly started to work. thank you so much. – François Romain Jul 27 '14 at 17:42