You have a couple of options:
1. If you are running apache
with a different user (not yours), and definitively want the DocumentRoot
to point to some directory inside your home, you meed to change permissions to your home directory (defaults must be 750
or 700
) to 755
I’d only recommend this if this is your laptop or your personal computer and no one else has access to it.
2. The first one is not an option but you still want the DocumentRoot
inside your home, then you can change the user who runs apache
. Edit its configuration file and look for directives User
and Group
.
3. Second one is still not an option, and still … you want things inside your home. Use apache’s mod_userdir. With the following configuration:
<IfModule mod_userdir.c> UserDir public_html UserDir disabled root <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> </IfModule>
This is the default configuration for Apache’s mod_userdir on Debian. You will be able to access:
/home/your-username/public_html/*
on your browser at the following address:
http://somewhere/your-username/*
4. Finally, you could place DocumentRoot
somewhere else (/srv/www
, /opt/www
or whatever) and setup permissions as needed.