skip to Main Content

I am trying to run Apache 2.4 on Ubuntu 21.10. However, I cannot get userdir to work. I did everything I can possibly google, except reinstalling apache. I am normally a Windows person, so this is driving me nuts.

What I did:

  • Enable userdir.conf
  • Set Permission of the folder public_html into 777, and change ownership to www-data
  • Add Require all granted to literally everywhere I can think of: apache2.conf, userdir.conf, and the config in sites-available to include
    <Directory /home/*/public_html >
     Require all granted
     AllowOverride All
     Options +Indexes 
   </Directory>   

Yet, for some reason, all I have is ERROR 403: Forbidden when trying to go to http://localhost/~myusername
What could I possibly be missing?
Thank you.

2

Answers


  1. Chosen as BEST ANSWER

    It turns out it is "because search permissions are missing on a component of the path". So just "chmod -R 755" my entire home folder. Probably not that good of a solution, but still, it works.


  2. Check your home directory

    $ ll -d /home/USER
    drwx------. USER USER /home/USER
    

    Then give it

    $ chmod 711 /home/USER
    drwx--x--x. USER USER /home/USER
    

    If you still receive this error, make sure that directories are set with chmod 755 but don’t run it across all files and folder, just run:

    find /home/USER -type d -exec chmod 755 {} ;
    

    The type -d will result only directories, and change them to 755

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search