Ubuntu server apache2 changing documentroot gives a 403
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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!
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.
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...
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 :<
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.