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 s
I would suggest checking the nginx logs - use sudo tail /var/log/nginx/homestead.app-error.log
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:
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) cd ~/Code
laravel new Laravel
. 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.
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!
OK, i got the answer to the question after few hours of searching and debugging.
The problem:
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.
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!
My solution was to move the address in the host file to the bottom of the file. It happend to me twice.