Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to connect to localhost:8080 with Vagrant and Ubuntu

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?

like image 212
François Romain Avatar asked Oct 01 '22 05:10

François Romain


1 Answers

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.

like image 102
fideloper Avatar answered Oct 02 '22 19:10

fideloper