0

I have changed the Apache2 public directory for years changing the content of file
/etc/apache2/sites-available/000-default.conf

so:

DocumentRoot /home/user/www
<Directory "/home/user/www">
   Require all granted
</Directory>

In the file: /etc/apache2/apache2.conf
I wrote the follow line as last line

ServerName localhost

Then I go to restarted Apache with:

sudo /etc/init.d/apache2 restart

All the past times this have resulted but in Ubuntu 21.04 when I go In my Web Browser to:
http://localhost it show me 403 error:

Forbidden
You don't have permission to access this resource.

I see it have changed somthing in Apache. How can I fix that?

Thanks

2
  • Does the user under which Apache is running (may be 'apache', 'www-data' or similar) have access to your /home/user/www directory? Also look at the Apache error log, you may find more detailed explanation there.
    – raj
    Aug 15, 2021 at 13:36
  • Ok Thanks. It's a problem with the permissions
    – ketter
    Aug 15, 2021 at 17:18

1 Answer 1

0

I have solved the situation not moving the directory, only I have asigned permissions to my user to the directory var/www/html

sudo chgrp www-data /var/www/html
sudo usermod -a -G www-data user
sudo chmod -R 775 /var/www/html
sudo chmod -R g+s /var/www/html
sudo chown -R user /var/www/html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .