Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 09-02-2006, 09:23 PM   #1
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Rep: Reputation: 31
Question altering document root for apache


I'm configuring apache 1 (one) for testing of php pages.

I need to alter the document root on a per site basis such that $_SERVER['DOCUMENT_ROOT'] will give the stem for the base page of any particular site.

I'm not sure whether it is alias-ing or virtual host-ing. I think, from reading httpd.conf that it's the later. However will I need to add a vhost section for each directory or is there a quicker way.

My test sites are under:

So I assume then I'll put http://sitename in my browser to access the site?


Old 09-02-2006, 09:35 PM   #2
Senior Member
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
you would need to create virtual host for your requirements.
Old 09-04-2006, 10:27 AM   #3
LQ Newbie
Registered: Aug 2006
Distribution: Debian/CentOS
Posts: 23

Rep: Reputation: 15
like this (in httpd.conf):

<VirtualHost *:80>
    ServerAdmin root@localhost
    DocumentRoot /var/www/
    ErrorLog /var/log/httpd/
    CustomLog /var/log/httpd/ common
Old 09-04-2006, 08:05 PM   #4
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Original Poster
Rep: Reputation: 31
OK that seems to work but I also have to enter the hostname pointed to in ym /etc/hosts file.


alias, apache, conf, vhost

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
Apache 403 when changin document root. webgovernor Linux - Newbie 3 04-20-2005 01:54 AM
Apache 2: won't allow document root to be changed, plus more QtCoder Linux - Networking 1 11-06-2004 05:44 PM
Document Root in Apache Hal Linux - Newbie 2 10-28-2003 07:10 AM
Apache Document Root Path bowen Linux - General 8 11-29-2002 03:13 AM > Forums > Linux Forums > Linux - Server

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