×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VirtualHosts

How to set up Mass Virtual Hosting on Apache. by Wullie
Posted: 27 Apr 02 (Edited 23 Jun 02)

Hi, This explains how to set up basic mass virtual hosting on Apache.

This is very useful if you are adding virtualhosts at different times as you do not need to keep restarting apache every time you add a new site.

In these instructions, I am assuming that you already have virtualhosts set up and working. If you do not, then please read the faq on how to set up virtualhosts first!!

Firstly, backup your httpd.conf in case there are any problems with the set-up.

Now uncomment the following two lines..

LoadModule vhost_alias_module modules/mod_vhost_alias.so

AddModule mod_vhost_alias.c

Add the following to the very bottom of the httpd.conf. If you already have virtualhost directives then you need to replace them..

#
# Set up the mass virtual hosting
#
<VirtualHost *:80>
   UseCanonicalName off
   VirtualDocumentRoot /www/%0
   VirtualScriptAlias /www/%0/cgi-bin
   ServerSignature EMail
</VirtualHost>
# End mass hosting set up

To explain how this works: Apache will replace %0 with the actual full domain that is requested. So, for example, if the visitor requested www.mydomain123.com then apache will look for the DocumentRoot in /www/www.mydomain123.com and the cgi-bin in /www/www.mydomain123.com/cgi-bin

You now need to configure the directories with your files in them to correspond with this set-up. Change all your virtualhost directories to the FULL domain name. So www.me.com would be called from /www/www.me.com and so on..

To set up subdomains, just change the directory name to match.. Eg. subdomain.domain.com would be called from the /www/subdomain.domain.com directory.

If you have scripts with the paths defined, you will also need to alter them to reflect these changes..

Hope this helps

Wullie

sales@freshlookdesign.co.uk
www.freshlookdesign.co.uk

Back to Linux (server) FAQ Index
Back to Linux (server) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close