skip to Main Content

I’m currently getting a 403 error on the storage directory.
I have tried the correct file path for both a php artisan link and the regular symlink from command line
The specific path is this one:

http://example.com/storage/app/public/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg

This is linked to the storage directory:
to here: example.com/public/storage/*

I created the symlink like so:

ln -s /var/www/vhosts/example.com/httpdocs/storage /var/www/vhosts/mydomain.com/httpdocs/public

The above directory is for the symlink one but for php artisan link the url is slightly different.

the permissions set for storage before were executed running:

chmod -R 775 storage/

checking permissions I get this:

ls -la ./httpdocs
drwxr--r--   5 pacer psacln          46 Apr  8  2021 storage

Everything else works except the storage directory. I’ve seen the other questions regarding 403 and have attempted those fixes but nothing is working. Any idea what I’m doing wrong?

3

Answers


  1. Chosen as BEST ANSWER

    After a while spent on this the error was caused because I ran the php artisan storage:link and ln -s link with root. Therefore the link was unaccessible by my server for public consumption.

    My solution was to switch to user:

    su myUser
    

    Then run the php artisan storage:link


  2. The storage link points directly to the "app/public" folder.
    So the link address will look like this :

    http://example.com/storage/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg
    
    Login or Signup to reply.
  3. first : run commint

    php artisan storage:link
    
    
    
    http://example.com/storage/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search