Question

Error on apche2 "You don't have permission to access / on this server."

Posted June 5, 2017 25.3k views
UbuntuApache

Hi all

i need you help as i face the bellow error when i change the Directory
“You don’t have permission to access / on this server.”
i change the working directory on
/etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot “/media/clerck/Downloads/”
ErrorLog ${APACHELOGDIR}/error.log
CustomLog ${APACHELOGDIR}/access.log combined
</VirtualHost>

&& /etc/apache2/apache2.conf
<Directory /home/clerck/Downloads/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

on the second file i only change the /var/www/html to the new directory

i even try to give the Directory 777 permission but still the same error

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

First of all change this line

<Directory /home/clerck/Downloads/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

to this line

<Directory /media/clerck/Downloads/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

And if it doesn’t work try to add those lines at /etc/apache2/apache2.conf

<Directory /media/clerck/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

sorry i miss with the file name, it didn’t work untill i apply this command
sudo chown -R www-data:www-data /media/clerck/Downloads

i face another issue when i try to use the real Directory, i change it on both files
/etc/apache2/apache2.conf && /etc/apache2/sites-enabled/000-deftault.conf
but the error appear again and “chown -R www-data:www-data ” didn’t solve the issue
this from log
clerck@clerck:/media/clerck/5b7ea25c-624b-4048-9c50-d3e76c9dc2e6/repos$ tailf /var/log/apache2/error.log
[Mon Jun 05 16:50:02.872782 2017] [core:error] [pid 17501:tid 140372126148352] (13)Permission denied: [client 127.0.0.1:50530] AH00035: access to / denied (filesystem path ’/media/clerck/5b7ea25c-624b-4048-9c50-d3e76c9dc2e6’) because search permissions are missing on a component of the path

this Directoty on external Hard Drive by the way|
so now it’s working on /home but didn’t work on the external hard
permission changed to 755 but still the same

Submit an Answer