skip to Main Content

I’m having an issue within Strapi CMS while trying to retrieve uploaded Media from the storage. I’m pretty sure that it’s related within the Shared Hosting platform as the solution works perfectly locally.

Steps taken to launch the project to Shared Hosting

  • I’ve created a plain project with npx create-strapi-app@latest command (common build)
  • I’ve added all the required credentials for MySQL database.
  • Ran npm run strapi build
  • Uploaded project to GIT.
  • Created a sub-domain called "configure" (folder to /public_html/configure was automatically generated)
  • Downloaded the GIT project to Shared Hosting into /public_html/configure
  • Setup Node JS application support from cPanel.
  • Ran npm install to install node modules
  • Ran npm run strapi start

The application starts up and I’m able to authenticate with my Superadmin.

Whenever I upload something, it’s being uploaded to /public_html/configure/public/uploads folder but the issue here is that when I try to retrieve media through the GUI Media Library I’m receiving the following error:

404 Not Found

  GET domain/upload/files?sort=createdAt:DESC&page=1&pageSize=10&filters[$and][0][folderPath][$eq]=/ 

What I’ve tried so far

  • Checked permission to the folder. Folder has 0775 permissions.
  • Tried messing around with .htaccess and added the following lines
    • RewriteEngine On
    • RewriteCond %{REQUEST_URI} !^/uploads/(.*)$
    • RewriteRule ^(.*)$ http://localhost:1337$1 [P,L]
  • Installed Cloudinary provider. Works locally, doesn’t work with the Shared hosting service provider, as the same error is being returned. The image itself is being uploaded to Cloudinary but is not visible in Media Library.
  • Installed the project multiple times from scratch

Any help or suggestions would be more than welcome.

2

Answers


  1. Chosen as BEST ANSWER

    Found an link in Strapi forum where mod_security is turned off and for some reason that seems to do the trick. Everything described above is now working.

    Someone with security knowledge could maybe elaborate, why mod_security is blocking Strapi to properly function.


  2. What shared hosting have you used to upload it to your cpanel, I have tried with namesheap and it is too complicated.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search