ERROR 403 - Forbidden

Discussion in 'Installation/Configuration' started by Kemp, Feb 14, 2023.

  1. Kemp

    Kemp Member

    I am getting the following error when trying to access an uploaded image to a folder, the image exists in the folder:

    The following error occurred:
    You are not permitted to access the requested URL.
    Please contact the webmaster with any queries.

    How can I resolve this?

    Thank you!
     
  2. remkoh

    remkoh Active Member HowtoForge Supporter

    Most likely something in your vhost config or a .htaccess file is causing this behaviour.
    Without any futher information about your config and setup in general (which webserver are you using for eample) it's impossible to tell what the exact cause may be.
     
  3. Kemp

    Kemp Member

    I am using a Laravel app that creates folders and files itself.

    Web server and app processes need to be able to read and write to the app directory.

    1. Can you please let me know the correct user/group to use for the hosted domain:
    Ex:
    sudo chown -R http:http . # change user/group to http user and http group
    client0:web1?
    www-data?

    2. If I run the following commands, the uploaded image loads, otherwise it doesn't show:
    sudo find . -type d -exec chmod 755 {} \; # set all directories to rwx by user/group
    sudo find . -type f -exec chmod 644 {} \; # set all files to rw by user/group

    3. I am getting 500 Internal Server Error when interacting with the app due to file and folder permissions

    Thank you!
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You can find the user and group name on the options tab of the website, it's never www-data. Or look at which user and group owns the web folder, all files and folders inside web folder must be owned by the user and group that owns the web folder, and never change username or group of the web folder itself. And you must ensure that you use correct website settings, PHP mode must be php-fpm and suexec checkbox must be enabled (when you use apache web server).
     
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Do not change owner or group owner of website files. ISPConfig sets them up just right, altering them makes the website not work or opens all kinds of security vulnerabilities.
    If the uploaded files are accessible if you chmod them, it seems the permissions are wrong (not owner). You have not revealed what the permissions are originally. Have you already changed onwers, group owners or permissions?
     
  6. Kemp

    Kemp Member

    App is creating image folders as:
    Owner: Read, Write, Execute
    drwx------

    Uploaded image files as:
    Owner: Read, Write
    Group: Read
    Public: Read
    -rw-r--r--

    No, I have not changed owner, group, or permissions but for testing only.

    Using php-fpm + suexec + apache web server
     
    Last edited: Feb 14, 2023
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Then the app created it with wrong permissions then, the folder must be group readable to allow apache to access the files, otherwise only PHP can access it.

    That's ok.
     

Share This Page