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.
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).
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
I'm trying to install multiple of the same homestead box. Each one for a different project, totally isolated from each other. None of them will be run concurrently, only one at a time.
But when I try to run vagrant up, it tells me that a box with the name 'homestead-7' already exists. How can I rename it?
I don't see the name anywhere in the vagrantfile in the project directory, nor any 'boxes' folder in either the project .vagrant directory or my home .vagrant directory. vagrant global-status tells me that there is 1 homestead-7 box already for the project that is already in progress.
You need to add "name" property under your "Homestead.yaml" file, for example:
name: my-new-homestead
and make sure that your authorize, keys and folders are pointing to the correct path.
To use Homestead in a per project basis, you need to add it as a dependency in each one of your projects:
composer require laravel/homestead --dev
Use php vendor/bin/homestead make to generate the Vagrantfile and Homestead.yaml files. Then you can simply run vagrant up from your project.
See more on the Laravel documentation.
I just installed Laravel Homestead according to their instructions. When I open http://homestead.app:8000 I get the nginx 403 forbidden HTTP Response.
I have tried setting app/storage permissions to 755, but that didn't work, so I reloaded Vagrant. With no further result.
I also tried changing the nginx configuration, but with no success.
I had the same problem and for me the cause was that in the Homestead.yaml file, I have incorrectly put this:
sites:
- map: homestead.app
to: /home/vagrant/Code
Instead of the correct syntax:
sites:
- map: homestead.app
to: /home/vagrant/Code/path/to/public
Another reason for this response can be duplicating your routing with folders in public directory. For example you might have homestead.app/lists GET route and lists folder in your /public directory. This will cause the same 403 error (server will assume you are trying to access /public/lists directory instead of your /lists route).
OK, i got the answer to the question after few hours of searching and debugging.
The problem:
I've got GET route /admin
Also i've got /public/admin/ folder with assets inside.
And i've got 403 access denied from nginx cause of this duplication;
So, if you don't want to rename route or assets folder, all you need to do is replace
location / {
try_files $uri $uri/ /index.php?$query_string;
# ^^^^^
}
with this:
location / {
try_files $uri /index.php?$query_string;
}
If you could rename your route or assets folder without any refactor then you could do this without nginx config fixing.
Hope this will be helpful.
I have been banging my head against the wall dealing with this very same problem, and I just solved it for my case.
I was sure I'd set up the yaml file correctly, but I kept getting the 403 error, and when experimenting with some routes I was getting "input file not specified".
My solution came from http://laravel.com/docs/4.2/homestead and it involved using the serve command. I wasn't adding any additional sites, just trying to anything to get the first site running.
SSH'ing into my vagrant box and using the command "serve my_app_name.app /home/vagrant/Code/path/to/public" did the job. Note that I had already put an entry into my hosts file for this app.
Hope this helps someone.
For some people this may be as simple as having git cloned in an existing public folder, e.g:
- map: hello-world.dev
to: /home/vagrant/Code/Laravel/public/hello-world
The correct folder structure is:
- map: hello-world.dev
to: /home/vagrant/Code/hello-world/public
Another good note is ignoring the laravel docs on editing hosts file, using git shell, or cygwin (windows) to install vagrant hostsupdater, and simply adding entries for hosts and aliases to ~/.homestead/Homestead.yaml file.
I would suggest checking the nginx logs - use sudo tail /var/log/nginx/homestead.app-error.log
Here's the full solution steps:
run homestead edit
add /public to the end of your directory
sites:
- map: homestead.app
to: /full/path/to/the/laravel-app/public
run homestead halt && homestead up --provision
Change the config of Nginx
Put that line in 'location /' section:
try_files $uri $uri/public/index.php?$query_string;
If its not working then replace your 'public' with the folder name that content 'index.php',
That worked great with me using ServerPilot,
Good luck!.
In my case, for testing purposes I had only phpinfo.php file in the public directory. The server kept showing 403 errors until I placed a file named index.php into the public folder!
In your case, you are getting nginx 403 forbidden HTTP Response because of improper configuration of sites in Homestead.yaml,
if you configure it properly it should work.
How to solve the issue step by step:
1) Goto your vagrant box and create the laraval app
$vagrant ssh
$cd ~/code
$#lets create basic blog
$laravel new blog
Crafting application...
Loading composer repositories with package information
........
$cd blog
$ll
# You should be able to see public folder in this dir.
# this is the entry point for your application.
# this is your public dir: ~/code/blog/public
# more explicitly: /home/vagrant/code/blog/public
$exit # exit ssh
2) Update the Homestead.yaml with proper site info
- map: homestead.app
to: /home/vagrant/code/blog/public # should be same as in step1
3) Re-provision your vagrant
$vagrant reload --provision
You should be able to access it now using http://homestead.app
Thank you!
I ran into this when I tried manually creating my first site. #GregD's answer helped me discover the problem! Vagrant/Homestead/Laravel will typically get everything running smoothly on its own if you use the built-in features.
Homestead's configuration file comes preconfigured for one site, located in /Code/Laravel/. Some steps to get this test bed up and running:
Install Homestead (remember to set your hosts file)
vagrant up and connect to your virtual machine via ssh (Chrome Secure Shell is great if you don't have a terminal on your machine already)
Download and set up the PHAR package
cd ~/Code
laravel new Laravel.
Browse to http://homestead.app:8000
This will create your first site with appropriate permissions. You can model future sites after the permissions on this one, or just use the "sites" node of Homestead.yaml and laravel new <site> to make new sites in the future.
Access in your browser
homestead.app/public
Before installation of laravel/laravel with composer within /home/vagrant/Code/Laravel/public
Configuring Nginx Sites :
sites:
- map: homestead.test
to: /home/vagrant/project1/public
To fix, ssh into your homestead, then do :
nano /etc/nginx/sites-available/the-name-of-your-project.test
After that all you need to do is get rid of $uri/ that you will find in the location object , then do vagrant reload and error should be fixed.
My solution was to move the address in the host file to the bottom of the file. It happend to me twice.
Check nginx error in you vagrant box
vagrant ssh
sudo cat var/log/nginx/yoursite.tld-error.log
"*1 FastCGI sent in stderr: "Unable to open primary script: /home/vagrant/code/public/index.php (No such file or directory)" "
Change in Homestead.yaml
nano Homestead.yaml
to
map: homestead.app
to: /home/vagrant/code/Laravel/public
then..
vagrant reload --provision