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
</VirtualHost>
I restarted the Apache server:
systemctl reload apache2
But when I go to http://localhost/testapp
, Apache responds:
Forbidden
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:After you change the file, reload Apache and you will be able to access the site.