Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 03-08-2007, 01:03 PM   #1
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Rep: Reputation: 15
apache2 on debian, DocumentRoot confusion

I'm running debian sarge. I recently moved to using apache2 from the old apache. I apt installed apache2 from repositories.

As I understand it, to set DocumentRoot the file /etc/apache2/sites-available/default must be edited.

The first time I set the document root, everything was fine.

I subsequently decided to change the root location from e.g. /home/andrews/oldroot to /home/andrews/newroot

Easy, I thought. Edited /etc/apache2/sites-available/default to point to newroot, deleted oldroot, and tried to restart apache2 using
apache2ctl restart
trouble followed

centurian> apache2ctl restart
Syntax error on line 1 of /etc/apache2/conf.d/testdefault:
DocumentRoot must be a directory

the offending file, had one line

centurian> cat /etc/apache2/conf.d/testdefault
DocumentRoot /home/andrews/oldroot/

Now, if I recreate an empty dir at /home/andrews/oldroot/, or if I did not delete it in the first place, the apache2ctl restart works fine, and my DocumentRoot for apache2 is the correct newroot dir. The file /etc/apache2/conf.d/testdefault still lists oldroot as DocumentRoot, however.

I am confused. Should I be editing /etc/apache2/conf.d/testdefault also to reflect the change in /etc/apache2/sites-available/default? That doesn't seem right. Presumably, the change is made once and then on restart it rewrites the other files.

The problem is not major, as I can easily get around it by having an empty dir called oldroot hanging around. However, I would guess I am missing something here.

Old 03-09-2007, 10:14 PM   #2
Dutch Master
Senior Member
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
No, you should leave the default file just that: default values. Create a new file, in the sites-available folder, containing your new document-root. Then create a sym-link from the sites-enabled folder to your new file.
Old 03-10-2007, 06:17 AM   #3
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Original Poster
Rep: Reputation: 15
thank you Dutch Master,

I did as instructed. I reverted the file /etc/apache2/sites-available/default back to what it was originally, and created a new file in etc/apache2/sites-available/ and created a symlink to this. I restarted apache2 and everything was fine. However, the file /etc/apache2/conf.d/testdefault still lists oldroot as DocumentRoot. If I delete the oldroot dir (which is empty), I get complaints. So I just deleted /etc/apache2/conf.d/testdefault and after that there was no more complaints upon restart.

Seems to work fine, but I'm not sure I did what I was proper.

I guess I'll just see what happens.

thanks again


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
APACHE2 DocumentRoot does not exist for Vhost Wonderm00n Linux - Software 2 04-09-2010 10:33 PM
apache2 group/owner DocumentRoot security deadeyes Linux - Security 3 02-24-2007 08:05 PM
debian apache documentroot see Linux - Newbie 2 02-28-2006 03:18 AM
Debian DVD download confusion!!! TigerLinux Debian 45 11-12-2005 01:12 AM
Debian confusion on installation e-bitch Linux - Distributions 6 11-09-2002 07:35 PM > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:41 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