Windows 10 Hosts file not working Laravel Homestead - laravel

I am trying to get windows to redirect homestead.localhost to the site i have setup in Laravel Homestead. But its not letting me access the page. i can access the site i setup by going to 192.168.10.10 but going to http://homestead.localhost in my browser brings up:
ERR_CONNECTION_REFUSED
My windows host file, the only line in it, has
192.168.10.10 homestead.localhost
And here is my Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/jarro/Documents/Sites
to: /home/vagrant/Sites
sites:
- map: homestead.localhost
to: /home/vagrant/Sites/homestead
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
So the question is, why is my windows 10 host not working.
I have did the following:
Cleared IP Config, Restarted computer, deleted and created a new vagrant, and reloaded the vagrant.
What am i missing?

sites:
- map: homestead.localhost
to: /home/vagrant/Sites/homestead
You have to map your site to the "public" folder of your Laravel Project! Something like:
to: /home/vagrant/Sites/myLaravelProject/public
Homestead doesn't have any index.php which could be referenced.

So after about a week of giving up, i decided to go back and try again. Found a post on Laracasts:
https://laracasts.com/discuss/channels/general-discussion/homestead-windows-10-need-to-specify-port-8000
All you have to do to fix what i am having done is add :8000 on the url and the site loads. Its not working on port 80 for some reason. I am gonna go fix this now so i can rest in peace.
:D

This is an old question but in the Hosts file I find it much easier to just use:
127.0.0.1 myapp.local
It works everytime. I have always had minor problems with using 192.168.10.10

Related

Second Vagrant Site Returns Empty Response

I have a vagrant/homestead setup with two sites.
The first one works as expected, but when I started up the server today the second one is just returning a 200 status with no body:
My Homestead file is as follows
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/code
to: /home/vagrant/code
sites:
- map: site1.test
to: /home/vagrant/code/site1-backend/public
- map: site2.test
to: /home/vagrant/code/site2-backend/public
databases:
- dbname
My hosts file is
192.168.10.10 site1.test
192.168.10.10 site2.test
Notes / Things I've Tried
If I stop the vagrant I no longer get the 200 response so it is definitely connecting to it
Any URL I go to at site2.test returns the empty 200 result
Going to site3.test does not connect
I am using Laravel in both projects, but there is no recent output in the Laravel logs
On Vagrant /var/log/nginx/site2.test-error.log is empty as is /var/log/nginx/error.log
Both projects have identical .htaccess files
Both projects have vagrant as the owner for all files
I have run
> vagrant destroy && vagrant up
To no avail.
I'm not sure how to further debug this issue.
This turned out to be an error in my Laravel .env file
Changing
APP_NAME=App Name
to
APP_NAME="App Name"
Fixed it. I was unable to find any logging to this effect and worked it by comparing my setup with my live server.

Laravel Homestead - No input file specified?

I am trying to install a Homestead VM for Laravel development on Debian Linux 8 with Vagrant 1.8.4 and VirtualBox 5.0.24 r108355.
Following the official documentation, I have installed Homestead and configured it in Homestead.yaml in the following way:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
sites:
- map: dev.todoparrot.com
to: /home/vagrant/Code/dev.todoparrot.com/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
To test it with a sample file, I have created an index.php in /home/user/Code/dev.todoparrot.com/public/ on my local machine that echos a string:
<?php echo "Hello from Homestead!"; ?>
I have also added dev.todoparrot.com to /etc/hosts:
127.0.0.1 localhost
127.0.1.1 debian
192.168.10.10 dev.todoparrot.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Within the Homestead folder of my local machine, the VM starts both via vagrant up and vagrant up --provision, but when I visit the domain http://dev.todoparrot.com/ in the browser, I get the following error:
No input file specified.
Any idea what could be wrong?
No input file specified
It says that you don't have any file in
/home/vagrant/Code/dev.todoparrot.com/public
For now, your Vagrant path is
/home/vagrant/Code/dev.todoparrot.com/
And you looking for dev.todoparrot.com/public in dev.todoparrot.com
That's your issue
You need change
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
to:
folders:
- map: ~/Code
to: /home/vagrant/Code
It will emulate all folders in Code to /home/vagrant/Code/
Run vagrant up --provision after every update of Homestead.yaml
And in the future, you need to change/add only
sites:
- map: project-name.app
to: /home/vagrant/Code/ProjectName/public
Use vagrant ssh to check your current folders structure inside Code
If you already tried
vagrant up --provision
and still you getting 'No input file specified' error, try to run
vagrant reload --provision
reload vagrant box works for me.

Laravel homestead not mapping my code folder

I am trying to get homestead to work after following the instructions here
I have Virtualbox 5.0.6 and Vagrant 1.7.4 on windows 8. The machine boots up fine(ish) the only problem is that my mapped folder is not present on the vm, meaning when I vagrant ssh, the directory /home/vagrant/ is empty, there is no Code directory inside of it. This is a screenshot of the machine booting(it should keep going and saying mapping the folders and stuff):
And this is the content of my Homestead.yaml file
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\Khalid\.ssh\id_rsa.pub
keys:
- C:\Users\Khalid\.ssh\id_rsa
folders:
- map: D:\work
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
Could someone please help, Thanks
EDIT: The full output of vagrant up --debug can be found here
sstarlight was on the right track. It's a path name issue. I'm on windows 8 with homestead too and you need to use the forward slashes even in your windows paths.
The below should do the trick!
authorize: C:/Users/Khalid/.ssh/id_rsa.pub
keys:
- C:/Users/Khalid/.ssh/id_rsa
folders:
- map: D:/work
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
I would add to this that you should run the provisioning as per the other answer after you make the change by bringing your homestead up with the --provision flag set.
Make sure and re-verify that the path for the keys and authorize are correct and run vagrant up --provision to re-provision the homestead setup again
Try change
D:\work to D:/work/

Homestead multiple sites not working

I'm a newbie on laravel, and running homestead I had one site before added another one did not work. I destroyed homestead and started once again and added two sites in Sites section in homestead.yaml file the bluprint of my homestead.yaml file is below
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/laravel
to: /home/vagrant/laravel
sites:
- map: project1.dev
to: /home/vagrant/laravel/project1/public
- map: project2.dev
to: /home/vagrant/laravel/project2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
I added those two sites in my /etc/hosts file as well blueprint is below
#laravel maps
192.168.10.10 project1.dev
192.168.10.10 project2.dev
but when i run project1.dev or project2.dev they both show me the content of project1.dev files
Any Idea?
You can't use tabs on the file, use only spaces to indentation and this will solve the problem.
Now, only run
vagrant reload --provision
To reload the configuration file.
Note: If you use vagrant destroy and vagrant up, you lose everything on your VM.
I think I needed to the vagrant provision command to restart the server and register the changes that I have made
so once you finished with homestead.yaml and /etc/hosts file run this
vagrant provision
Like how here says, you can install Homestead directly into your project, require it using this composer require laravel/homestead --dev at root directory of each project you have. Now by make command you can generate Vagrantfile and Homestead.yaml file into your project's root directory.
Mac/Linux:
php vendor/bin/homestead make
Windows:
vendor\bin\homestead make
On each project root you will have a Homestead.yaml file to edit:
Project-A
ip: "192.168.10.10"
...
folders:
- map: "~/Code/projecta"
to: "/home/vagrant/projecta"
sites:
- map: project.a
to: "/home/vagrant/projecta/public"
Project-B
ip: "192.168.10.11"
...
folders:
- map: "~/Code/projectb"
to: "/home/vagrant/projectb"
sites:
- map: project.b
to: "/home/vagrant/projectb/public"
Add this to /etc/hosts:
192.168.10.10 project.a
192.168.10.11 project.b
Then you have to cd to each project's root and vagrant up.
Now if you vagrant ssh from each project, you will have that project in your VM environment.
Of course there is a Homestead.yaml file inside ~/.homestead, but vagrant goes for the .yaml file that is located inside project root first. In my case, the ~/.homestead/Homestead.yaml file is ignored.

Homestead 2.0 giving issues on Yosemite

I have this strange problem. Let me describe it:
The mapping on the .yaml doesn't work. forum.app will just open up a Google search.
The debug is set to true for local, yet, errors aren't presented in browser. They're logged though.
I am using Homestead 2.0, Laravel 4 (everything is latest) on a Yosemite (updated today). The code is here:
YAML file
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /Users/aligajani/Dropbox/Work/Code
to: /home/vagrant/Code
sites:
- map: forum.app
to: /home/vagrant/Code/CommunityFT/forum/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
HOSTS file
#Added by XAMPP Control
127.0.0.1 Alis-MacBook-Pro.local
192.168.10.10 forum.app
In order to get forum.app to be a valid domain that works with Homestead, you'll need to point it to your local computer in your hosts file.
You can do this by opening up terminal, and typing vim /etc/hosts, then add the line:
127.0.0.1 forum.app
Your browser may fail to look up the forum.app domain too, so remember to try adding a forward slash teh first time you visit it, so forum.app/, this will prevent the browser trying to google it.
Errors not being presented to the browser may be something to do with this pull request:
https://github.com/laravel/homestead/pull/140
Which is an Nginx configuration issue.
Hope this helps!

Resources