Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need VirtualHost Help (Dynamic Subdomains)

Status
Not open for further replies.

mrtopher

Programmer
Aug 27, 2003
34
US
I am trying to set up dynamic sub-domains on my serverand its not making a lot of sense to me. I am what you would call web server inept. I have read the follow apache article: and havn't come away with much more than confusion.

I am fairly certain that I need to create a new virtual host directive in my httpd.conf file. But I have tried that (in what I believe is the correct way) and been unsuccessful. Please take a look at whats below and see if you can help me out.

I am obviously editing a VH directive that was created by my server (I'm using a virtual private server running HSP Complete). I don't really know if I need all the stuff it put in there or not.

Code:
<VirtualHost 66.242.17.138:80>
  <Directory /home/webadmin/campname.badgetracker.info/html>
    Options Indexes Includes FollowSymLinks
    AllowOverride All
  </Directory>
  
  ScriptAlias /cgi-bin/awstats /var/[URL unfurl="true"]www/cgi-bin/awstats[/URL]
  Alias /awstats /var/[URL unfurl="true"]www/html/awstats[/URL]
  Alias /myadmin /var/[URL unfurl="true"]www/html/myadmin[/URL]
  ScriptAlias /mail /var/[URL unfurl="true"]www/cgi-bin/openwebmail/openwebmail.pl[/URL]
  ScriptAlias /cgi-bin/openwebmail /var/[URL unfurl="true"]www/cgi-bin/openwebmail[/URL]
  Alias /openwebmail /var/[URL unfurl="true"]www/html/openwebmail[/URL]
  ServerName *.badgetracker.info
  DocumentRoot /home/webadmin/campname.badgetracker.info/html/system
  SuexecUserGroup webadmin webadmin
  ServerAlias "[URL unfurl="true"]www.campname.badgetracker.info"[/URL]
  ServerAdmin "cmonnat@leftofcentercom.com"
  ScriptAlias "/cgi-bin/" "/home/webadmin/campname.badgetracker.info/cgi-bin/"
  CustomLog "/home/webadmin/campname.badgetracker.info/access_log" "combined"
  ErrorLog "/home/webadmin/campname.badgetracker.info/error_log"
</VirtualHost>


The basic gist of what I'm trying to accomplish is to get every request for "whatever.badgetracker.info" to go to /home/webadmin/campname.badgetracker.info/html/system directory.

Any help would be greatly appreciated!!
 
I believe they way you have it setup, it is using IP based Virtual Hosting so anything that has IP address
66.242.17.138
will do the same thing.

One thing, do you mean HOST.badtracker.info is truly
anything, or names that you configure?

You CAN setup it up so that
blahblah.badgetracker.info goes to this server, but that would require a wildcard DNS record such that * with
an A record to 66.242.17.138.

If you mean to use distinct names, then you want those to have A records to 66.242.17.138 and you want to change to name-based virtual hosting. That way, ServerName will control which virtual server you are matching.
(In your example, I believe that using
* in ServerName is not operating. I don't believe
regular expressions are allowed in that directive.)
That is why I think you are using IP based Virtual Hosting, which can't be determined by the snippet you provided.

gene
 
I believe that my server is using name based virtual hosting, at least according to what I have read.

I am trying to set this up so I dont have to add an additional record to a configuration file every time I set up a new sub-domain. I'm looking to create a web based app that allows all the users to have their own sub-domain. Similar to this:


And they say that I need to do is add the following directive:

ServerName *.tadalist.com

Thats what I thought I did above but its not working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top