Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-20-2005, 02:44 PM   #1
Registered: Jan 2004
Posts: 48

Rep: Reputation: 15
How do I change document root in apache2 in Ubuntu?

Hey I need some help with this. I have apache2 and of course the default is to have the web sites in /var/www. I have a second slave hard drive mounted to /webserver which is where I want the document root to be. I changed apache2.conf and also tried changing default in apache2/sites-available but whenever I try to access the site from http://localhost I get a "Forbidden you do not have permission" error. I don't know how to set the permissions. Someone said make sure user apache is part of the apache group or www group but I have no user called apache and no groups called www or apache or anything similar. I just did a default install of Ubuntu which had Apache 1.3 installed. I removed it and put 2 on but even before removing I had no users or groups like that. Anyone know what I need to do? Thanks.
Old 03-20-2005, 03:12 PM   #2
Registered: Dec 2004
Location: Ohio
Distribution: Fedora Core 3
Posts: 125

Rep: Reputation: 15
The exact error message would be helpful.

The short, quick way of the west....

chown -R apache:apache /newapache/directories

chmod -R ug+r /newapache/directories

make sure DocumentRoot points to /newapache/directories

Make sure your index file is index.html unless you changed the DirectoryIndex directive.

Did you restart apache?

Don't abbreviate the error message.
Old 03-20-2005, 04:21 PM   #3
Registered: Jan 2004
Posts: 48

Original Poster
Rep: Reputation: 15
K first off that doesn't work. When I do your first command it says "Chown: 'apache:apache': invalid user." There is no user called apache on my system, there never was when I installed and when I reinstalled apache it never created one. I don't know the exact error because I don't have it set back to /webserver as document root, it's just a standard Error 403: Forbidden. It says Error 403, Forbidden. You do not have permission to access index.html. Do I just need to make a user called apache or something?
Old 03-21-2005, 05:54 PM   #4
Registered: Jan 2004
Posts: 48

Original Poster
Rep: Reputation: 15
Certainly this has to be a common topic I dunno why it's so hard, does anyone know the answer to this? I need to know asap Thanks.
Old 03-30-2005, 07:18 AM   #5
Hmm ^_^
LQ Newbie
Registered: Aug 2004
Distribution: gentoo
Posts: 2

Rep: Reputation: 0
Red face my solution

You only have to change the DocumentRoot Dir:
DocumentRoot /your/new/dir


add the following section in your config file:
<Directory "/your/new/dir">
allow from all
Options +Indexes


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache - change document root? squall14716 Linux - Software 2 01-20-2010 11:16 AM
setting the document root firaysinafets Ubuntu 2 04-07-2005 10:07 AM
Apache Qs: Moving Document Root and PHP with Apache2 larsenmtl Linux - Networking 3 09-29-2004 09:31 AM
apache2 w/ ssl - "document contains no data" with https tree_buddy Linux - Security 2 11-23-2003 09:44 PM
Document Root in Apache Hal Linux - Newbie 2 10-28-2003 07:10 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration