Homestead 2.0 multiple sites, all link to the same url - laravel

Hee guys, little question: So i have setup the Homestead 2.0 and everything is working fine. I wanted to add another project in the same code directory but link it to another url. So i added it in the sites list but when i visited laravel.app it all works fine, but when I visit larabook.app it shows me the laravel.app page! Both urls are linked to 192.168.10.10 in my /etc/hosts file.
I have tried restarting my mac and restarting the vm but nothing is working :'(
/etc/hosts
192.168.10.10 laravel.app
192.168.10.10 larabook.app
Homestead.yaml
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: laravel.app
to: /home/vagrant/Code/Laravel/public
- map: larabook.app
to: /home/vagrant/Code/Larabook/public
databases:
- homestead
- larabook

Assuming your Homestead.yaml file above
type in:
$ vagrant global-status
will display something like;
id name provider state directory
--------------------------------------------
77c5c30 default virtualbox running et....
type in:
$ vagrant provision 77c5c30
Of course this assumes you only have 1 VM, if you have others then read the instruction when you run vagrant provision

This works for me, and didn't lose the database:
$ homestead halt
$ homestead up --provision

Try this
folders:
- map: ~/Code/Laravel
to: /home/vagrant/Code/Laravel
- map: ~/Code/Larabook
to: /home/vagrant/Code/Larabook
sites:
- map: laravel.app
to: /home/vagrant/Code/Laravel/public
- map: larabook.app
to: /home/vagrant/Code/Larabook/public
databases:
- homestead
- larabook
Note: look at the changes i have made to the folders section.
find out more from https://www.easylaravelbook.com/blog/configuring-multiple-laravel-homestead-sites-and-databases/#top
after run
$ homestead halt
$ homestead up --provision

Related

Laravel Homestead - ‘no input file specified’

I've set up the project many times, but this time, when I use vagrant up and try to go into the website, it says "no input file specified".
I have set up the hosts file
I have logged to the vagrant ssh to ensure the files/folders are linking and they are
I have tried destroying the virtual machine, building it again, --provision etc..
This is the code for the project from the Homestead file
folders:
-
map: ~/portfolio
to: /home/vagrant/code
sites:
-
map: portfolio.test
to: /home/vagrant/code/public
php: "7.2"
No matter what I do, I just go between the errors "No input file specified" and "403 Forbidden
nginx/1.15.6"
Check if your path are correct and the folders exist.
Open your command line and move to the location and run following command
pwd
That is going to return the path.
You are also not pointing in to your actual project, shouldn't this:
folders:
-
map: ~/portfolio
to: /home/vagrant/code
sites:
-
map: portfolio.test
to: /home/vagrant/code/public
php: "7.2"
be something like this:
folders:
-
map: ~/portfolio
to: /home/vagrant/code
sites:
-
map: portfolio.test
to: /home/vagrant/code/myapp/public
php: "7.2"
Further you should try following:
homestead up --provision
or
vagrant up --provision

The web.app page isn’t working

When i try to open web.app it doesnt work. But vagrant up running successfully. Hier is my Homestead.yarn file
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/www/
to: /home/vagrant/www
sites:
- map: web.app
to: /home/vagrant/www/web
databases:
- homestead
I'm using Mac OS.
laravel box : laravel/homestead (virtualbox, 1.1.0)
in hosts 127.0.0.1 web.app (192.168.10.10 and 127.0.0.1 both doesn't work)
vagrant and homestead are up to date. Any idea?
web.app:8000 doesn't work else
First on your homestead.yaml file, make the following changes
folders:
- map: ~/www/web
to: /home/vagrant/www/web
sites:
- map: web.app
to: /home/vagrant/www/web/public
Then go to your Homestead folder and do
vagrant reload --provision
After reloading do
vagrant up
Then edit the /etc/hosts file and add the following line
192.168.10.10 web.app
Now you should get laravel homepage when you hit web.app on your browser
I don't know why but my hosts file is ignored. Therefore i used just 192.168.10.10 instead web.app after 10 hour i fixed the problem. just deleted hosts file and created it again.

Homestead did't generate the second config file in vm nginx

It seems that my homestead vagrant only generate one site,can't not generate multisite
my Homestead.yaml is:
…
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: homestead.treeline-lumen
to: /home/vagrant/Code/treeline-lumen/public/
sites:
- map: homestead.Laravel-5-Bootstrap-3-Starter-Site
to: /home/vagrant/Code/Laravel-5-Bootstrap-3-Starter-Site/public/
databases:
- homestead
…
My homestead version is:
➜ ~ homestead --version
Laravel Homestead version 2.2.1
when i ssh into vm ls only one config:
vagrant#homestead:~$ ls /etc/nginx/sites-enabled/
homestead.Laravel-5-Bootstrap-3-Starter-Site
and i have
➜ Homestead git:(master) vagrant destroy
➜ Homestead git:(master) vagrant up
after changed Homestead.yaml config
the http://homestead.treeline-lumen:8000/ and http://homestead.laravel-5-bootstrap-3-starter-site:8000/ point to the same project.I want the http://homestead.treeline-lumen:8000/ point the right project.It seems that is the Homestead did't generate the second config file in vm nginx.
How can i resolve this,anybody can help me?
sites:
- map: homestead.treeline-lumen
to: /home/vagrant/Code/treeline-lumen/public/
sites:
- map: homestead.Laravel-5-Bootstrap-3-Starter-Site
to: /home/vagrant/Code/Laravel-5-Bootstrap-3-Starter-Site/public/
should be
sites:
- map: homestead.treeline-lumen
to: /home/vagrant/Code/treeline-lumen/public/
- map: homestead.Laravel-5-Bootstrap-3-Starter-Site
to: /home/vagrant/Code/Laravel-5-Bootstrap-3-Starter-Site/public/
And to reprovision without having to destroy it can be done with
vagrant up --provision

PhpMyAdmin on Laravel 5 Homestead, Windows

I downloaded phpmyadmin to my /Code folder, and then updated my Homestead.yaml file:
folders:
- map: C:\Users\{ myname }\Code
to: /home/vagrant/Code
- map: C:\Users\{ myname }\Code\phpmyadmin
to: /home/vagrant/Code/phpmyadmin
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: phpmyadmin.app
to: /home/vagrant/Code/phpmyadmin
I updated my hosts file also...
{ ip from homestead.yaml} phpmyadmin.app
When I browse to phpmyadmin.app it displays the same site as homestead.app.
I'm using Windows.
Is there some way to restart homestead? How do I get this to work?
You'll need to reprovision your homestead vm with
vagrant provision
See Adding Additional Sites

No laravel sync folders in homestead vagrant on windows

i installed vagrant lately on my windows 7 machine, i successfully runned the virtual machine because i can ssh to it but no synchronization between my local project and the homestead.
my yaml file is like :
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /Users/User/Homestead/projects
to: /home/vagrant/sites
sites:
- map: laravel.dev
to: /home/vagrant/sites/laravel/public
hhvm: true
databases:
- homestead
variables:
- key: APP_ENV
value: local
My laravel project is inside projects folder in my local homestead directory, but it seems that the sites folder that links to it is not synced with it !!
i'm not good at unix command line but is it weird that ls -la command work but ls alone don't seem to work as i saw if tutorials ?
update :
After changing the hosts file setup for : 127.0.0.1 laravel.dev to 192.168.10.10 laravel.dev the site was accessible in my browser, but the problem of no syncronization still happening (i had to install a new laravel in vangrant) i want to deplay my project from wamp to projects folder and be syncronized with "sites" in homestead
Edit your Homestead.yaml
In the line
---
folders:
- map: E:/projects //your projects folder here
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
Now if you are using Windows, open notepad as administrator and your hosts
System32/drivers/etc/hosts
192.168.10.10 laravel5angularapp.dev
192.168.10.10 angular2laravel.dev
192.168.10.10 laravel5-angular2.dev
192.168.10.10 yourproject.dev
Now access your homestead
homestead up
homestead ssh
Inside homestead
cd Code
ls -a
All your projects should appear here, then
cd ~
then
serve yourproject.dev /home/vagrant/Code/yourlaravelprojectname/public/
Then
sudo service nginx restart
Or
homestead reload
Your project should be running in
http://yourproject.dev
I've tried many things but none of them worked. Finally i've changed map folder to the full path version and then run the vagrant reload command and it was ok.
Homestead.yaml
folders:
- map: C:/Users/username/Code
to: /home/vagrant/Code.
vagrant reload
You can use ~/Homestead/projects in windows is the same the C:\Users\your_user\your_folders

Resources