Results 1 to 6 of 6

Thread: How do I set up apache2 win32 subdomains?

  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    20

    How do I set up apache2 win32 subdomains?

    Hey all I'm a bit confused with this. My website delusionaldreams.com runs on apache 2 win32 yes winblows sucks I know. I want to set up sub domains for my domain but how do I do this? I believe what I want to do is Name based virtual host because I want like java.delusionaldreams.com to point to the same server but I don't know how to set it up. Also do I have to do anything with DNS ?

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    It has a lot to do with DNS.

    They aren't technically subdomains, despite the fact that that's what people usually call them.

    They are really just A or CNAME records in an existing domain.

    The way these work, is based on the fact that web sites do not have to run on a host name called "www".

    Create either an A record (Address) or a CNAME record (Alias) pointing at either the IP address of your box, or the host name of your box respectively.

    So for example, you might have (in your zone file)

    Code:
    java A 192.168.1.1.
    wibble CNAME java.delusionaldreams.com.
    I can't remember the exact syntax, but that's similar. If you use a web control panel on your DNS provider, it will probably check the syntax.

    Anyway, once you've done that, wait for the DNS to propogate (can take days), then, once lookups succeed from your web server (i.e. nslookup java.delusionaldreams.com does the right thing), you can set up Apache.

    This is really easy. Put something like this into httpd.conf (or make an include and put it in there - that's what I usually do)

    Code:
    <VirtualHost java.delusionaldreams.com>
    DocumentRoot "c:/my/document/root/or/wherever"
    </VirtualHost>
    <Directory "c:/my/document/root/or/wherever">
    # Options or  Whatever you want etc
    </Directory>
    Inside the VirtualHost element in the apache config file, you can put most Apache config directives, including setting up logging and access control independently of your main host. Otherwise, any options are the same as those of the master.

    Slarty

  3. #3
    Junior Member
    Join Date
    Oct 2003
    Posts
    20
    cool thanks slarty

    Ok one more question the java.delusionaldreams.com seems to be bringing up the main web page. Is this only because the dns hasn't updated yet or is this apache ?

    I added this to the httpd.conf file does it look good ?

    Code:
     <VirtualHost java.delusionaldreams.com>
    	ServerAdmin fleacricket@hotmail.com
    	DocumentRoot "C:/something/something/Java"
    	ServerName java.delusionaldreams.com
     </VirtualHost>
    
     <Directory "C:/something/something/Java">
         AllowOverride None
         Options None
         Order allow,deny
         Allow from all
     </Directory>

  4. #4
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    Originally posted here by phreeOn
    Ok one more question the java.delusionaldreams.com seems to be bringing up the main web page. Is this only because the dns hasn't updated yet or is this apache ?
    It doesn't seem to work for me at all. I get a DNS error.

    You have restarted Apache following the config change (restart or graceful restart) ?

    I added this to the httpd.conf file does it look good ?
    Looks fine - although I suspect the Allow, Deny is unnecessary.

    Slarty

  5. #5
    Junior Member
    Join Date
    Oct 2003
    Posts
    20
    That's weird http://java.delusionaldreams.com doesn't work at all? Cause I am seeing what looks like in the attachment. I tried doing a false one like blah.delusionaldreams.com and I did recieve a notice saying it couldn't find it. So i don't know what's going on.

    I first ran the test apache configuration and it worked cool, then i restarted apache since it's a service I hope it did it graceful. If everything looks good maybe it's just the dns.

  6. #6
    Junior Member
    Join Date
    Oct 2003
    Posts
    20
    I FINALLY FLIPPIN GOT IT!

    Code:
    NameVirtualHost *
    <VirtualHost *>
    	DocumentRoot "C:/mainroot/"
    	ServerName www.delusionaldreams.com
    </VirtualHost>
    
    <VirtualHost *>
    	ServerAdmin fleacricket@hotmail.com
    	DocumentRoot "C:/somepath/mainroot/Java"
    	ServerName java.delusionaldreams.com
    	ErrorLog logs/java-error_log
    	CustomLog logs/java-access_log common
    </VirtualHost>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •