2

I was running localhost (Apache 2.4.6) but only the index.php was openable in the web browser. The subdirectories were returning 403 Forbidden error.

Now, I added the permissions according to this answer. For reference, these were the permissions:

sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rw /var/www

Accordingly, the folder in which I placed all the content of the website became owned by www-data group. And although I've added myself to the group, I cannot open the folder!

(But the subdirectories have become accessible from the web browser.)

Abhimanyu
  • 1,393

1 Answers1

9

First are you sure your user is added to www-data group? The proper way to add your user to this group is:

sudo adduser yourusername www-data

Then do:

sudo chown yourusername:www-data -R /var/www

After that, you should change permissions to 755, it is not recommend changing permissions to 777 for security reasons

sudo chmod 0755 -R /var/www  
sudo chmod g+s -R /var/www
Sh1d0w
  • 1,348
  • Oh it worked! I just didn't do the last step (change permissions to 755). By the way, my directory was not /var/www. Thanks! – Abhimanyu Apr 07 '15 at 04:06