I have Apache installed on an Ubuntu virtual machine.

Typing http://localhost in the browser brings up the Apache intro site, so I know Apache works.

I created the file /home/test/webs/testapp/index.html:

This is a <b>test</b>.

I changed the DocumentRoot in the file /etc/apache2/sites-available/000-default.conf so that it points to a directory under my home directory:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/test/webs
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

I restarted the Apache server:

systemctl reload apache2

But when I go to http://localhost/testapp, Apache responds:


You don't have permission to access this resource.

Apache/2.4.41 (Ubuntu) Server at localhost Port 80

What do I have to do to give the anonymous web users permission to view this web directory via Apache?


Add this to the end of your 000-default.conf file:

<Directory /home/test/webs>
  Options FollowSymLinks 
  AllowOverride All
  Order deny,allow
  Allow from all

After you change the file, reload Apache and you will be able to access the site.

  • Thanks, this is the answer for Apache 2.2. but for Apache 2.4, I had to change Allow from all to Require all granted. Sep 12 '20 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.