Reputation: 9647
Though there are many similar questions here but I could not fix my problem from them.
I have installed Apache/2.4.7 (Ubuntu)
in my ubuntu(14.04)
. I have changed two configuration files to change the default DocumentRoot
of apache
which is /var/www
to /home/name/www
. The files I have changed are /etc/apache2/apache2.conf
and /etc/apache2/sites-available/000-default.conf
. In apache2.conf
I put
<Directory /home/name/www>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and in 000-default.conf
I changed,
DocumentRoot /home/name/www
My /home/name/www
file has necessary permissions.
drwxr-xr-x 3 www-data www-data www
But when I try to access localhost
from browser I receive
You don't have permission to access / on this server.
error. What have i missed?
Upvotes: 2
Views: 3756
Reputation: 9647
For changing the default root directory of apache
from /var/www
to /home/<username>/www
following changes worked for me.
I edited the following values of etc/apache2/apache2.conf file like this. Before editing the file it's a good practice to keep a backup of the original.
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /home/<username>/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Then I changed /etc/apache2/sites-available/000-default.conf file's DocumentRoot
.
DocumentRoot /home/<username>/www
After that restart the apache server,
sudo service apache2 restart
Upvotes: 1