I wan to use my Dropbox/Web directory as the server directory for LAMP. I cahnged /etc/apache2/sites-available/default
DocumentRoot /home/me/Dropbox/Web #changed from /etc/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/me/Dropbox/Web/> #changed from /etc/www
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
And now I get
Forbidden
You don't have permission to access / on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
Best Answer
www-data
, the group/user Apache runs is not allowed to read in your home directory.You can use regular permissions to change that as gertvdijk explained in its answer.
I would consider using
acl
instead of regular permissions, allowing to add permission to apache instead of replacing the group in home directory or making the directory world readable.For that, you need to install acl:
You can use
man setfacl
to have more info.To add permissions to apache:
1st and 2nd commands will allow Apache (www-data) to change directory only through the path (without allowing other subdirectories) in your home. They are probably not needed if you are using default config but if you already changed permissions (or will change in the future) to disalow
other users
to read in your home, they are needed.The 3rd one is the command that will allow Apache to read and change directories in Dropbox/web and sub-directories).
Obs: uppercase
X
will act only on directories instead of lowercasex
that would act on both files and directories (this way apache user is only able to change directories, not executing files).