Reputation: 642
I'm using Laravel Homestead to VM into my dev environment. I recently created a new mapping (the /Website/Site/
directory) in my Homestead.yaml whenever I go to site.app
page , I'm redirected to the /tasks page which was set in another project (/Laravel
). (This results in an error, since the page isn't there). Here is my Homestead.yaml file:
folders:
- map: /Users/me/Homestead/Code/Laravel
to: /home/vagrant/Code/Laravel
- map: /Users/me/Homestead/Code/Larabook
to: /home/vagrant/Code/Larabook
- map: /Users/me/Homestead/Code/Website/Site
to: /home/vagrant/Code/Website
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: larabook.app
to: /home/vagrant/Code/Larabook/public
- map: site.app
to: /home/vagrant/Code/Website/public
variables:
- key: APP_ENV
value: local
The Laravel contains the route where the index page is redirected and the Website directory is the new project that is just a fresh install of Laravel and nothing else. Here is some of the Server/Request Data error output:
SCRIPT_FILENAME /home/vagrant/Code/Laravel/public/index.php
SCRIPT_NAME /index.php
REQUEST_URI /tasks
DOCUMENT_URI /index.php
DOCUMENT_ROOT /home/vagrant/Code/Laravel/public
Here is the route.php for the project in Laravel/ (i.e. the old project)
Route::get('/', function(){
return Redirect::to('tasks');
});
Why is a fresh install of Laravel being redirected by a project in a different directory?
vagrant reload --provision
or, more drastically
~/Homestead
run vagrant destroy
then vagrant up
Upvotes: 18
Views: 10454
Reputation: 465
I could fix that issue using the serve
command provided with the homestead box.
When you're connected to the VM run:
serve personal.local /home/vagrant/projects/personal/personal-site/public
without the need to reboot the VM.
I've tried vagrant reload --provision
and it reloads the yaml file but seems not the ngnix configuration.
Upvotes: 1
Reputation: 212
If you have a running homestead instance, simply issue the command homestead provision
from your local machine.
Upvotes: 2
Reputation: 161
You can run homestead up --provision
to force the reload of the Homestead.yaml file.
Upvotes: 10
Reputation: 1906
I ran into this issue too.
Presumedly, the changes in Homestead.yaml
file are being ignored. So, I resolved to refresh it.
! REVISED SOLUTION THAT DOES NOT DESTROY YOUR MACHINE
My solution below is inadequate because it destroys your existing machine. See this solution first!
Once your Homestead environment is provisioned and running, you may want to add additional Nginx sites for your Laravel applications. You can run as many Laravel installations as you wish on a single Homestead environment. There are two ways to do this: First, you may simply add the sites to your Homestead.yaml file and then run vagrant provision.
Alternatively, you may use the serve script that is available on your Homestead environment. To use the serve script, SSH into your Homestead environment and run the following command...
http://laravel.com/docs/homestead#daily-usage
Per the Laravel.io forum the better solution is to run vagrant reload --provision
.
See also
OLD SOLUTIONS: USE AS LAST RESORT
Try these solutions:
~/Homestead
run vagrant reload
then vagrant up
or, more drastically
~/Homestead
run vagrant destroy
then vagrant up
OPTION 2 DESTROYS YOUR SERVER AND ITS DATABASES
Note: I resorted to step 2.
Upvotes: 21