LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-07-2004, 12:50 PM   #1
Sillysoft
LQ Newbie
 
Registered: Mar 2004
Posts: 11

Rep: Reputation: 0
Apache httpd Question


Hope this is in the right forum. Had a general question about name based virtual host setup in httpd. What if you wanted multiple names such as mail.domain.com and help.domain.com for one domain? I add it in my dns but since it is named based in apache I have to specify where the name resolves to folder wise.

Instead of 2 virtual entries can I do all resolves under 1 virtual entry? Right now I do this for 2 subdomains:


<VirtualHost *:80>

ServerName domain.com
ServerAlias mail.domain.com
DocumentRoot /path1/

</VirtualHost>


<VirtualHost *:80>

ServerName domain.com
ServerAlias domain.com
DocumentRoot /path2/

</VirtualHost>

Is there a way to do it with just one entry?

Thanks
Silly
 
Old 04-07-2004, 01:13 PM   #2
msound
Member
 
Registered: Jun 2003
Location: SoCal
Distribution: CentOS
Posts: 465

Rep: Reputation: 30
i really doubt theres a way to do it with just one <VirtualHost> tag but i could be wrong. Is there a reason why you dont want to just use 2, youre only adding 2 extra lines by doing it this way
 
Old 04-07-2004, 01:14 PM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
You need to entries but the ServerName's will need to be:
ServerName help.domain.com
ServerName mail.domain.com

For your main website domain.com you may wish to use a ServerAlias - ie:
ServerName domain.com
ServerAlias www.domain.com
 
Old 04-07-2004, 02:06 PM   #4
Sillysoft
LQ Newbie
 
Registered: Mar 2004
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by msound
i really doubt theres a way to do it with just one <VirtualHost> tag but i could be wrong. Is there a reason why you dont want to just use 2, youre only adding 2 extra lines by doing it this way
For organizing purposes

Silly
 
Old 04-07-2004, 02:35 PM   #5
msound
Member
 
Registered: Jun 2003
Location: SoCal
Distribution: CentOS
Posts: 465

Rep: Reputation: 30
sometimes ive found that making a separate file to list all your virtualhosts is a nice was to stay organized. This way your httpd.conf file doesnt get out of hand. At the bottom of the httpd.conf file where I would normally put the virtualhost tags, I put "include conf/httpd.include" and I stored all of the virtual host information in an httpd.include file in the /httpd/conf directory. Just an idea.
 
Old 04-07-2004, 02:47 PM   #6
Sillysoft
LQ Newbie
 
Registered: Mar 2004
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by msound
sometimes ive found that making a separate file to list all your virtualhosts is a nice was to stay organized. This way your httpd.conf file doesnt get out of hand. At the bottom of the httpd.conf file where I would normally put the virtualhost tags, I put "include conf/httpd.include" and I stored all of the virtual host information in an httpd.include file in the /httpd/conf directory. Just an idea.
Great suggestion. Quick question, is it normal to have a very large virtual host file if you are hosting a lot of domains? Or is there a limit?

Silly
 
Old 04-07-2004, 03:57 PM   #7
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
With very large systems you can actually do it using a database and a perl script. There is a doc on the apache website about it.
 
Old 04-07-2004, 04:12 PM   #8
Sillysoft
LQ Newbie
 
Registered: Mar 2004
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by david_ross
With very large systems you can actually do it using a database and a perl script. There is a doc on the apache website about it.
What is your definition of large systems?

Silly
 
Old 04-07-2004, 05:17 PM   #9
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Whenever the sysadmin starts finding it difficult to manage the vhost config

It doesn't really matter how large but for most systems I wouldn't use it. Why not give it a try and see what you think.
 
  


Reply


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 (HTTPD) question rblampain Programming 2 07-08-2005 11:03 PM
Apache httpd DocumentRoot question orange400 Linux - General 7 05-24-2004 03:41 AM
httpd (apache) rpm question kapot Red Hat 2 11-10-2003 05:43 AM
apache httpd.config question fibbi Linux - Software 4 10-18-2003 10:07 AM
Apache Log file (httpd.access_log) question eallen Linux - Networking 2 07-02-2002 10:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:48 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration