I'm using Vagrant to run a server for me. So I followed this tutorial and when I open up my browser to go check. I get Oops! Google Chrome could not connect to 127.0.0.1
. I've also tried localhost
and my IP address. Along with a mixture of different ports. The odd part is when I do curl 'localhost'
or curl 'http://127.0.0.1:80'
I get
<html><body><h1>It works!</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>
</body></html>
I do know that's normal, but I can only get that to show on the command line. Any ideas?
You must set up port forwarding in your Vagrantfile. See https://docs.vagrantup.com/v2/networking/forwarded_ports.html
Example:
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080
end
I've had issues using Vagrant and got some help. Here is my post and how i made it work: