0
votes

System & Tools:

Im having problem with laravel & vagrant setup. The same setups used to work with laravel 5.1 but now with 5.2 its stopped working. When I open the URL http://laravel.app it redirect to my localhost page not laravel app.

But if i do http://laravel.app:8000/ it gives Unable to connect firefox can't establish a connection to the server at laravel.app:8000.

Please guide me what i'm doing wrong. i'm new to laravel and vagrant and did managed to run 5.1 few weeks ago but now 5.2 is stcuk with virtualbox php 7

Instructions followed from laravel site:


~.homestead/Homestead.yaml

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/www/sites
      to: /home/vagrant/Code

sites:
    - map: laravel.app
      to: /home/vagrant/Code/Laravel/public

databases:
    - homestead

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

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

hosts

127.0.0.1   localhost
127.0.1.1   raven
192.168.10.10   laravel.app

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Forwarding ports...

default: 80 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
3

3 Answers

1
votes

Your /etc/hosts file should point your domain to 127.0.0.1, this is because homestead forwards 127.0.0.1:8000 to port 80 on your vagrant box. In this case 192.168.10.10:80.

So your /etc/hosts should look like this

127.0.0.1    laravel.app

In your browser you should then access http://laravel.app:8000/

1
votes

Thanks to @Wader for helping me out. With his help I found the problem. Coming from Windows user experience the case sensitive names got me this time.

The homestead.yaml file had Laravel as site directory while my directory name was in lower case laravel. I capitalised the directory and it worked. Along with the IP change and appending the port as suggested by @Warden

0
votes

Try placing


box: laravel/homestead-7

at the top of your homestead.yaml file

Then in terminal enter homestead ssh

then type in serve laravel.app /home/vagrant/Code/laravel/public