Ubuntu server apache2 changing documentroot gives a 403
Hi all!
First off, thank you for taking your time to help me out! I have a basic setup with ubuntu-server (10.04) and apache2 (by apt-get). The thing is I can't change the documentroot of my web page from /var/www to example /home/user/www although the directory is created and the necessary changes has been made in /etc/apache2/sites-available/default. I've figured this is a permission issue since I always get a 403 error every time I try to access my http://local-ip-to-server. My permissions set to the new folder is as follows: drwxr-xr-x 2 user user 4096 2010-05-31 18:27 www (where user is me) Same goes for the files inside www drwxr-xr-x 2 user user 4096 2010-05-31 18:27 . drwx------ 6 user user 4096 2010-05-31 18:48 .. -rw-r--r-- 1 user user 29 2010-05-31 18:27 index.html Also, the desktop installation I have of ubuntu 10.04 has no problem with changing the documentroot to /home/user/www by just creating that folder and putting a basic index.html inside. The permissions are exact as I figure it. Am i missing something here? Please help! |
Did you also change the <Directory "/var/www"> to <Directory "/home/user/www">?
|
Hi Blue_Ice
Yes I did, no luck. I also saw that apache2.conf refers to envvars to be user and group www-data, so I changed chown www-data:www-data to my /home/user/www directory, still though, no luck. Still 403. |
FYI
I don't know if this is safe, but I changed the group from www-data/www-data to user/user in envvars in /etc/apache2/, and now it works like a charm. Get back to me if this is wrong! Cheers all! |
Probably because the useraccount www-data is not allowed to access /home/user, you get the 403 error. By using useraccount user you gave apache access to the directory. Although I don't think that this is the correct way to give access to user directories. I would have created a sym link from /home/user/www to /var/www.
Using mod_userdir is possible as well... |
How do you make a sym link? Sounds like fun ^^
|
Code:
# rm -r /var/www |
Use the "ln -s" command to make a symbolic link (symlink). Read "man ln" for more details.
If you want your user account to be able to edit files in the web root, it would be better to change the permissions on /var/www to allow that. You generally don't want Apache to have access to your user account (especially if you're allowed to use sudo). That can allow a cracker to have all sorts of fun... |
I see, thanks mates
I'll sym link the directory for sure. Blue_ice, are you sure about removing the /var/www directory? |
Yes, unless you have data in it.
The www directory will be replaced with the www sym linked directory. |
Quote:
I don't understand how a symlink can point to (from ?) a non existing directory. |
As there will be no sym link to /var/www. /var/www will be the sym link.
|
So lads, when creating the sym link... Do I use /var/www as documentroot in /etc/apache2/site-available/default or do I use my user ?
I've tried it with default documentroot (/var/www/) and then its back to good old 403 :< |
All times are GMT -5. The time now is 08:46 AM. |