vagrantvagrantfile

Vagrant Refused via browser


I am very new to using Vagrant in my development workflow, however when setting up the box using vagrant up and then accessing it via my host i get a connection refused with my browser.

Is all that needs to be done to work is: vagrant init scotch/box vagrant up

?


Solution

  • Make sure to forward the 80 port from the guest so you can access the vm from your browser. Edit your Vagrantfile and make sure to have a line like (by default when doing vagrant init I believe this is commented)

    config.vm.network "forwarded_port", guest: 80, host: 8080
    

    You can then access your web server (if running on the VM) from http://127.0.0.1:8080 or http://localhost:8080

    If you prefer to use a fixed private IP, you will need to add

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

    you will then access the vm server using http://192.168.33.10

    note: