Setting up GitHub project on Laravel Homestead - laravel

I haven't got a lot of programming experience but I have found this open source GitHub project (https://github.com/daveroverts/bmac) but I am not sure how I can clone this to my Laravel Homestead virtual machine server.
I have initiated homestead and vagrant, which is running fine but I'm not sure how I can add the GitHub project to the server.
Would I just need to find my code folder and put the files on GitHub into a project folder or would I need to go into the virtual machine with virtual box?
Appreciate your help and sorry that my programming knowledge is so bad.

On Laravel Homestead, you have a shared folder. Anything in that folder can be accessed both through the virtual machine and with normal browsing on your computer. You should clone the project (e.g. project1) into that folder. The path is listed in Homestead.yaml. In this example, you would then map homestead.test to your localhost in your hosts file, and access the site through the browser at homestead.test.
folders:
- map: ~/code/project1
to: /home/vagrant/project1
sites:
- map: homestead.test
to: /home/vagrant/project1/public
You should never have to really "go into Virtual Box" to do anything. Just use a command line to vagrant ssh into the virtual machine and run any commands from there. See https://laravel.com/docs/8.x/homestead#configuring-homestead for the full setup.

Related

Laravel new project with vagrant/homestead

I just followed the manual at the laravel website and installed homestead.
When running vagrant up it runs fine and I can connect using vagrant ssh.
There is only one step I can not find, how do i start a new laravel project using the vagrant installation.
I can ssh to the vargant machine so I assume I should run laravel new someproject somewhere on the vagrant environment?
In my Homestead.yaml I have:
folders:
- map: D:/Documents/repos/someproject
to: /home/vagrant/someproject
sites:
- map: someproject.test
to: /home/vagrant/someproject/public
Where someproject is currently empty as i want to start a new project and not work on an existing one. I do not have composer/php/mysql on my windows machine but I assume the benefit of the vargant box is that it has all the needed dependencies and I should run it in vagrant.
I tried running it in /home/vagrant but i got:
laravel new someproject
In NewCommand.php line 110:
Application already exists!
new [--dev] [--auth] [-f|--force] [--] []
'
So how do I start the new laravel project after installing vagrant?
The message says that the application someproject already exists. Does the folder already exists in /home/vagrant?
Make sure to add the domain to your hosts file. For Ubuntu, this would be in/etc/ folder. If you want to access your website through someproject.test add
192.188.10.10 someproject.test
to your hosts file.
The site link has to be mention in you Homestead.yaml
sites:
- map: someproject.test
to: /home/vagrant/somneproject/public
Make sure to call
vagrant reload --provision
after saving the changes.
Now if you type someproject.test into the browser you should see the default page (assuming you have generate the key for your laravel application, otherwise you may get an error).

local folder not populated when create new project

I am attempting to set up Homestead on a Windows 10 machine using VirtualBox and Vagrant so it can live in a virtual machine.
Using Git Bash, here is the sequence of steps thus far -
connect to Homestead virtual machine using vagrant ssh
run this command to create a new project called Laravel:
look at folders in Homestead directly on VM:
So far, so good.
Now here is where things don't seem to be working properly -
look in storage location on host operating system where Homestead.yaml is configured to park files
but there are no files there
Two questions:
What needs to be changed so the files appear in the designated location on Z:?
Once the change has been made, how will the files appear there when the project has already been created on the VM?
EDIT:
I was able to remove the original Laravel project using the comment below from #dparoli. After cd code I executed composer create-project --prefer-dist laravel/laravel Laravel but encountered the error shown below: [ErrorException] mkdir(): File exists. I'm guessing there's left over stuff from the first attempt. What should be done to clear up the error?

Homestead.test default file gives [No input file specified] Ubuntu

I just installed Ubuntu 17.10 and I want to try create a website using Laravel, but I hit a rock, I followed the instructions. step by step on the official website. But I think something is missing,
Because I haven't touch / edit anything in Homestead.yaml, so basically it would working right?
I already use vagrant up --provision. already create the ssh key. I already googled it and try several ways but it doesn't fix it, I already turn on my XAMPP as well
Sorry but I never touched Ubuntu before, so I'm very blind using this OS
Here is my Homestead.yaml file
Homestead.yaml
and the directories of /home/workspace/ and /home/workspace/Homestead/
~ Dir
Homestead Dir
my Hosts file
Hosts File
EDITED:
I just create a new project in ~/Homestead/Projects/[it goes here] because the default laravel installation is working already, so now I want to create a new project in Projects folder inside Homestead, but why it redirect the url to https?
The folders
in this screenshot: https://i.stack.imgur.com/4cxGy.png Your ~/code folder appears to not exist, which means Homestead will not map it. Create that folder in your Host OS (Ubuntu 17) and then run vagrant destroy && vagrant up If you still have issues post the entire output here for us to check.
For my last question, why when I tried to open my new projects is always giving me this error your internet connection is not private. it's because I'm using .app or .dev in the of the site name, the problem is from google chrome, so I need changed it to .test then it's working perfectly.
I got the answer from this site
https://laracasts.com/discuss/channels/laravel/chrome-blocked-localhost-with-error-your-connection-is-not-private

Proper way to destroy and re-create a VM with Homestead

I have followed the instructions here: http://laravel.com/docs/5.1/homestead to get a local Homestead VM. It worked perfectly and I got Laravel up and running (serve homestead.app /public) and synced to a folder on my host machine (say ~/Code).
After trying to get Xdebug running, I messed up with a few configuration files (nginx.conf, php.ini, etc.). and thus, I destroyed that VM instance by running "vagrant destroy default". I then boot-up the VM again ('vagrant up') and ssh into the box. The files which I changed were reverted (expected) and the ~/Code directory had the Laravel sample app which I had created previously (again, expected as it was copied over from my host machine).
What I don't get is why the server was still running successfully and I could access my sample app from my host machine? I never ran 'serve homestead.app /public' again and yet the server was already running serving the /public folder. I find this very confusing.
So what’s the correct way to destroy and recreate Homestead VMs?
Cheers, SK.
Destroy command does't remove box.
Here is docs. https://docs.vagrantup.com/v2/cli/destroy.html
To delete it:
homestead yourbox remove
if it doesn't work, try
vagrant yourbox remove

Laravel Homestead vhost configuration

I am using Laravel homestead. For a project I need a special vhost configuration, where should I define this?
You add a new folder mapping into the "sites" block of Homestead.yml, like so:
- map: myapp.com
to: /home/vagrant/Code/myapp/public
That's all there is to adding a new vhost. To modify it, edit the appropriate file in /etc/nginx/sites-available. In the above case, this would be /etc/nginx/sites-available/myapp.com
See here for example customization of a newly added vhost. Note that the quick tip linked here uses Homestead Improved, a slightly enhanced version of Homestead, as described here.
More Homestead related posts can be found on our site via the Homestead tag.
I have been looking for a solution for customizing nginx vhosts. You want to do it in provisioning, or better: after provisioning otherwise Homestead will overwrite any changes you have done manually to the vhost files.
One solution is the one I found here:
https://laracasts.com/discuss/channels/requests/homestead-provision-deletes-custom-nginx-settings
Basically you create configuration files in a folder in the host machine, map that extra folder to the vagrant machine, then in your after.sh file (which is run by homestead after the normal provisioning is finished) you just copy all of them to nginx's sites_available folder.

Resources