prokaryote
prokaryote

Reputation: 53

Laravel/Homestead 403 forbidden

I am getting the 403 Forbidden | nginx/1.11.1 error. I have everything set up correctly but I keep getting this error. I've dabbled in some other similar issues here on Stackoverflow and other sites but none have giving me results. This is my first time using Homestead for Laravel.

IP is listed in the /etc/hosts file as homestead.app

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: /home/prokaryote/Code
      to: /home/vagrant/Code

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

*********EDIT*****************

Here are the permissions for the Laravel directory in my terminal.

machine@User:~/Code/Laravel/public/blog$ namei -l ~/Code/Laravel/public/blog
f: /home/prokaryote/Code/Laravel/public/blog
drwxr-xr-x root       root       /
drwxr-xr-x root       root       home
drwxrwx--- prokaryote prokaryote prokaryote
drwxrwxr-x prokaryote prokaryote Code
drwxrwxr-x prokaryote prokaryote Laravel
drwxrwxr-x prokaryote prokaryote public
drwxrwxr-x prokaryote prokaryote blog

Here are the permissions within the Virtualbox machine for the Laravel directory.

vagrant@homestead:~$ namei -l ~Code/Laravel/public/blog
f: /home/vagrant/Code/Laravel/public/blog
drwxr-xr-x root       root       /
drwxr-xr-x root       root       home
drwxr-xr-x root       root       vagrant
drwxrwxr-x vagrant    vagrant    Code
drwxrwxr-x vagrant    vagrant    Laravel
drwxrwxr-x vagrant    vagrant    public
drwxrwxr-x vagrant    vagrant    blog

Upvotes: 1

Views: 4855

Answers (2)

prokaryote
prokaryote

Reputation: 53

Okay lads I have done figured it out. I was trying to access the root files of Laravel not the public folder which is not allowed in server environments. It was the folder hierarchy. Now that I think about it it makes sense. Simple error.

example (Hierarchy Error):

sites:
    - map: homestead.app
      to: ~/Code/Laravel/public

Laravel(Public folder container) -> public(Laravel proj. folder) -> Laravel project(root directory)

example (Correct hierarchy):

sites:
    - map: homestead.app
      to: ~/Code/Laravel(root directory of Laravel)/public(accesible folder)

Laravel(root directory) -> public(accessible folder not root)

Upvotes: 4

Hiren Gohel
Hiren Gohel

Reputation: 5042

Your folder might be wrong.

Open a terminal window in your project directory and enter

pwd

This prints the working directory, change the working directory in your yaml file.

Hope it helps. I am also new to Laravel.

Upvotes: 2

Related Questions