LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

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

Rep: Reputation: 31
Question altering document root for apache


Hi,

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:
/var/www/htdocs/test/sitename
/var/www/htdocs/test/site2

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

Thanks.

pbhj
 
Old 09-02-2006, 08:35 PM   #2
w3bd3vil
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, 09:27 AM   #3
blankbmx
LQ Newbie
 
Registered: Aug 2006
Distribution: Debian/CentOS
Posts: 23

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

Code:
<VirtualHost *:80>
    ServerAdmin root@localhost
    DocumentRoot /var/www/
    ServerName domain.com
    ServerAlias www.domain.com
    ErrorLog /var/log/httpd/domain.com-error_log
    CustomLog /var/log/httpd/domain.com-access_log common
</VirtualHost>
 
Old 09-04-2006, 07:05 PM   #4
pbhj
Member
 
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 127.0.0.1 in ym /etc/hosts file.
 
  


Reply

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


All times are GMT -5. The time now is 01:26 PM.

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