403 Forbidden You don't have permission to access /folder-name/ on this server

176,719

Solution 1

Solved the problem with:

sudo chown -R $USER:$USER /var/www/folder-name

sudo chmod -R 755 /var/www

Grant permissions

Solution 2

under etc/apache2/apache2.conf, you can find one or more blocks that describe the server directories and permissions

As an example, this is the default configuration

<Directory /var/www/>
   Options Indexes FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>

you can replicate this but change the directory path /var/www/ with the new directory.

Finally, you need to restart the apache server, you can do that from a terminal with the command: sudo service apache2 restart

Solution 3

if permission issue and you have ssh access in root folder

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

will resolve your error

Solution 4

**403 Forbidden **

You don't have permission to access /Folder-Name/ on this server**

The solution for this problem is:

1.go to etc/apache2/apache2.conf

2.find the below code and change AllowOverride all to AllowOverride none

 <Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride all      Change this to--->  AllowOverride none
    Require all granted
 </Directory>

It will work fine on your Ubuntu server

Share:
176,719

Related videos on Youtube

ssuljic
Author by

ssuljic

Full-stack developer with experience in developing on various application stacks. My strength lies in taking responsibility and solving problems and critical tasks efficiently. I strive to learn something new and apply the best practices on daily basis. Specialities: Ruby, Ruby on Rails, JavaScript, AngularJS, Heroku

Updated on July 05, 2022

Comments

  • ssuljic
    ssuljic almost 2 years

    I was looking for an answer to my problem, but I could'nt find any answer which solves my case.

    The problem is that I can't access the app folders in my var/www/ folder. When I go to localhost/ i get the message that my server is running and I have access to phpmyadmin too. But when I go to any localhost/folder-name i get the 403 error:

    Forbidden

    You don't have permission to access /folder-name/ on this server.

    Apache/2.2.22 (Ubuntu) Server at localhost Port 80

    How can I solve it? Btw I'm using Ubuntu 13.04, and thanks for your answers. :)

    • Gagravarr
      Gagravarr over 10 years
      You might want to post your the vhost section of your apache config, so people can check what you've configured and hopefully spot what's incorrect!
  • Emre Koç
    Emre Koç almost 10 years
    It didn't worked for me. I'm getting chmod: cannot operate on dangling symlink `phpmyadmin'
  • Luciano Bargmann
    Luciano Bargmann almost 7 years
    What the heck is this doing?
  • Hassan Ali Shahzad
    Hassan Ali Shahzad almost 7 years
    Giving permissions in this way, resolve issues when some time not resolved by conventional way
  • Deepesh Thapa
    Deepesh Thapa about 4 years
    This worked for me. Just need to place Allowoverride to Non on the virtual host file. The apache config file does not have directory so need to put that in the vhost file

Related