Subdomains and Apache

Discussion in 'Server Operation' started by redstar, Apr 21, 2005.

  1. falko

    falko Super Moderator Howtoforge Staff


    It's not working for me. The site cannot be found.
    Is the correct IP address?

    mh1:~# dig
    ; <<>> DiG 9.2.1 <<>>
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15555
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
    ;   IN      A
    ;; ANSWER SECTION: 3560 IN    A
    ;; Query time: 57 msec
    ;; SERVER:
    ;; WHEN: Thu Jun 21 16:22:56 2007
    ;; MSG SIZE  rcvd: 61
  2. tommytomato

    tommytomato New Member


    I know its not working because i have the server off, by the time you get around to viewing the link, I've probley turn it off and i'm out to work ;)

  3. Dutzzu

    Dutzzu New Member

    tks for help falko :D

    i have a new question now: if i want to host 2 domains on a single server, what do i have to change in httpd.conf ?!? just paste a code similary like that for virtual host ?!?
    smt like this ( if i have, and now i want to add another domain - )

    Listen 80
    NameVirtualHost *
    <VirtualHost *>
      DocumentRoot /www/webroot
    <VirtualHost *>
    DOcumentRoot /www/webroot/

    Is this corect ? or i have to past smth else ( another code ) somwhere else ?
  4. falko

    falko Super Moderator Howtoforge Staff

  5. commanderxai

    commanderxai New Member

    Compound Subdomains?

    Since this is along the same lines how would one accomplish a compound subdomain.


    in my <VirtualHost> Tag this is what I listed as the primary data:

            ServerAdmin [email protected]
    	ServerAlias *.*.*.* *.*.* *.* * 
    	DocumentRoot /my/path/to/root/
    Obviously this wont work (already tried). httpd does not fault, but it won't let me us any more than one domain. I am sure it is possable though because you see it on government websites alot (course maybe it is a government thing).

    Any ideas?
  6. commanderxai

    commanderxai New Member

    Hey, I figured it out to anyone who is interested.

    	ServerAdmin [email protected]
    	ServerAlias "^(a-zA-Z0-9_.)+$" * 
    	DocumentRoot /my/path/to/root/
    The last ServerAlias directive is redundant, but I left it in there anyway.

    Maybe someone can find this handy.
  7. rul3z

    rul3z New Member

    What if you are using Dynamic DNS? Who shall you point the subdomain to the correct IP?

    Isn't there any work around?
  8. falko

    falko Super Moderator Howtoforge Staff

    You can use CNAME records that point to your address.
  9. rul3z

    rul3z New Member

    Yes actually I finally managed to figure that out yesterday and sorry for not saying that here. I found it in the forum.

    Thanks falko

Share This Page