YaSh Chaudhary
YaSh Chaudhary

Reputation: 2725

vagrant homestead can't access host(laravel 5.2)

When I goto my host ao.dev:8000 or ao.dev, "this site can't be reached,ao.dev refused to connect" is displayed.

My yaml file:

enter image description here

also i've my view file:

i've checked:

enter image description here

I've run vagrant up command by going to Homestead directory .

Also see: https://stackoverflow.com/questions/38801375/vagrant-up-not-forwarding-all-portshomesteadlaravel-5-2windows-10

Upvotes: 12

Views: 3963

Answers (5)

Yevgeniy Afanasyev
Yevgeniy Afanasyev

Reputation: 41450

I had the same problem, I installed and run fiddler and it was enough to solve it.

Upvotes: 0

YaSh Chaudhary
YaSh Chaudhary

Reputation: 2725

Actually I was using WAMP before installing homestead. So I uninstalled both i.e. wamp and homestead setup including vagrant and virtual box. Then I installed homestead setup again and it worked. I dont know the logic behind but maybe wamp and homestead were conflicting. It worked so I posted the answer.

Upvotes: 3

Leith
Leith

Reputation: 3299

What I needed to do to get my local Laravel up and running:

  • use 127.0.0.1 rather than 192.168.10.10 in my hosts file
  • make sure the .env file had the correct hostname listed as the APP_URL
  • make sure to use the :8000 port to access the site

Additionally:

  • if you're adding multiple sites, make sure to run vagrant provision after adding each site to your Homestead.yaml
  • not sure if it makes a difference, but you might want to put a space after the colon for the map command, i.e. map: ao.dev
  • I did not need to add hostname or name elements to Homestead.yaml

Upvotes: 2

Jamesking56
Jamesking56

Reputation: 3901

Here is an example Homestead.yaml file from one of my own projects:

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
hostname: vm
name: vm
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: "."
      to: "/home/vagrant/example"

sites:
    - map: example.dev
      to: "/home/vagrant/example/public"

databases:
    - example

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

Notice how my paths are double-quoted (to: "/home/vagrant/example")? In your code above, these paths are not double-quoted as they should be.

I also recommend after you fix your configuration that you completely destroy and re-create your VM by running:

vagrant destroy -f && vagrant up

In your Laravel project root directory.

Upvotes: 1

Jesús Amieiro
Jesús Amieiro

Reputation: 2483

Your Vagrant VM machine is up but you can't reach to the machine.

Can you paste your hosts file on your host machine?

Can you paste the output of a "nmap 192.168.10.10" from your host machine?

Can you paste "ls /etc/nginx/sites-enabled/ -la" on your Vagrant VM machine?

Upvotes: 0

Related Questions