train_fox
train_fox

Reputation: 1537

access files on laravel storage access forbidden by apache

I'm trying to use laravel storage API. I can make directory and save files on storage/app/users/user_id/filename but when i want to use files on web page i get forbidden 403. I made a symbolic link:

ln -s storage/app/users public/users

I checked all permissions and they are fine. I changed all permissions to 777 but nothing changed. Here is my apache configuration for this virtual server:

<VirtualHost *:80>
    ServerName kamel.dev
    DocumentRoot "/home/morteza/development/repo/kamel/public"
    <Directory /home/morteza/development/repo/kamel/public>
        AllowOverride All
        Options FollowSymlinks
        Order allow,deny
        Require all granted
        Allow from all
    </Directory>
</VirtualHost>

Chrome error message when i use files:

GET http://kamel.dev/users/2/phpDiLp1O.jpg 403 (Forbidden)

And this is apache response for calling url directly:

Forbidden

You don't have permission to access /users/2/phpDiLp1O.jpg on this server.

Upvotes: 3

Views: 4220

Answers (1)

train_fox
train_fox

Reputation: 1537

The problem was in how i made symbol link. Here is create symbolic link command:

cd public

after going to public directory use this:

ln -s ../storage/app/users users

Upvotes: 8

Related Questions