Pritam Bohra
Pritam Bohra

Reputation: 4339

Homestead project runs only when used 127.0.0.1 in the hosts file

I am new to the Homestead and virtualbox/vagrant world. I went through some video tutorials on how to strat working with Homestead. Everything went smoothly until the last step. It says we need to add the IP address mention in the Homestead.yaml file into the hosts file.

I did that, but it always gave me the following error:

This site can’t be reached dev.test refused to connect. Search Google for dev test 8000 ERR_CONNECTION_REFUSED

My hosts file looks something like this: 192.168.10.10 dev.test

But when I use 127.0.0.1 dev.test it works perfectly fine.

I don't know what's happening. Even the official documentation says we should 192.168.10.10 dev.test in the /etc/hosts file.

Where am I going wrong??

Here's my Homestead.yaml file

ip: "192.168.10.10"

memory: 2048

cpus: 1

provider: virtualbox

authorize: ~/.ssh/laravel.pub

keys: - ~/.ssh/laravel

folders: - map: /var/www/Laravel

  to: /home/vagrant/Laravel

sites: - map: dev.test

  to: /home/vagrant/Laravel/test/public

databases: - homestead

Upvotes: 1

Views: 923

Answers (1)

Pritam Bohra
Pritam Bohra

Reputation: 4339

Looks like I found my mistake. I was trying to access my web app using port 8000 even after using 192.168.10.10 dev.test in the hosts file. I should have simply used dev.test in the browser to access the web app.

Silly Mistake. I makes perfect sense to use dev.test:8000 in the browser if the hosts file reads 127.0.0.1 dev.test

Upvotes: 0

Related Questions