Results 1 to 9 of 9

Thread: Apache win32 Virtual Hosts I'm stuck

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    102

    Apache win32 Virtual Hosts I'm stuck

    I'm have 2 domain names that I want to host on the same server. I'm using apache win32 on windows 2000. It's not my choice I would have gone with a linux box but this is what is setup.
    I've been trying for the last hour to set this up correctly. I've read and searched google.com for some tips and looked on apache.org website and I still haven't done it right. I'll post up my config file just for show. Could someone show me what I'm doing wrong and how to do it so I can host 2 domain names on the same box?

    Code:
    ### Section 3: Virtual Hosts
    #
    # VirtualHost: If you want to maintain multiple domains/hostnames on your
    # machine you can setup VirtualHost containers for them. Most configurations
    # use only name-based virtual hosts so the server doesn't need to worry about
    # IP addresses. This is indicated by the asterisks in the directives below.
    #
    # Please see the documentation at <URL:http://www.apache.org/docs/vhosts/>
    # for further details before you try to setup virtual hosts.
    #
    # You may use the command line option '-S' to verify your virtual host
    # configuration.
    
    #
    # Use name-based virtual hosting.
    #
    NameVirtualHost *
    
    #
    # VirtualHost example:
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for requests without a known
    # server name.
    #
    <VirtualHost www.domainone.com>
     ServerName www.domainone.com
     DocumentRoot "C:/program files/apache group/apache/htdocs"
    </VirtualHost>
    
    <VirtualHost www.domaintwo.com>
         ServerName www.domaintwo.com
         DocumentRoot "C:/program files/apache group/apache/htdocs/domaintwo"
    </VirtualHost>
    Good Grief

  2. #2
    Junior Member
    Join Date
    Feb 2003
    Posts
    9
    first of all.......I would do this with the paths instead.
    ----------------------
    C:/program files/apache group/apache/htdocs/domainone

    C:/program files/apache group/apache/htdocs/domaintwo
    -------------
    also remembner that after you make changes to the file, apache needs to be restarted to pick up the current configuration.
    ---------------

    I hope this helps....
    accessdenied

  3. #3
    str34m3r
    Guest
    What sort of behavior are you getting? Is apache just delivering one of the domains? Is it giving you error messages? The only time I used VirtualHosts, I had to actually put the external IP address in the NameVirtualHost field to get it to work correctly. I don't know if it absolutely has to be set, but when I finally got it to work, it was with that field set.

    EDIT: I'm sure you've already covered this, but just in case... You have to make sure that DNS entries will point both domains to this box or it won't ever work.

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Posts
    102
    codergish tried that still didn't work. The error that I'm getting with the same setup that I posted earlier is.

    Code:
    [warn]VirtualHost www.domainone.com:80 overlaps with VirtualHost www.domaintwo.com:80, the first has precedence, perhaps you need a NameVirtualHost directive
    [warn] NameVirtualHost *:80 has no VirtualHosts
    then of course I get the
    Apache/1.3.27 (Win32) running...
    I always restart the server after I edit the config file and I know for sure the dns is working correctly because domaintwo is setup riight now to display the domainone page.

    Anyways still stuck.
    Good Grief

  5. #5
    Junior Member
    Join Date
    Feb 2003
    Posts
    9
    k..the most likely cause as, str34m3r suggested then is this

    use ip's here instead.....I would also stick to the same paths as I suggested....

    <VirtualHost ##.##.##.##>
    ServerName www.domainone.com
    DocumentRoot "C:/program files/apache group/apache/htdocs"
    </VirtualHost>
    accessdenied

  6. #6
    Senior Member
    Join Date
    Oct 2001
    Posts
    786
    Perhaps this may work.

    <VirtualHost *>
    ServerName www.domainone.com
    DocumentRoot "C:/program files/apache group/apache/domainone"
    </VirturalHost>

    <VirtualHost *>
    ServerName www.domaintwo.com
    DocumentRoot "C:/program files/apache group/apache/domaintwo"
    </VirturalHost>


    I'm not exactly sure if this will work, because I had edited my HTTPD.conf file because I can't set up my DNS. Then, I just decided that two domains was out of the question for me. I also set my own error-logs/admin emails for each domain, but that can be done after it is set up. But, I haven't be able to get my DNS set up to check if that acutrally works... I hope it does...

    BTW, if a domain isn't found, I think the first one is used as default. Also, I don't know if this is name-based or multi-homed...but I hope it may work...

    -Tim_axe

  7. #7
    Senior Member
    Join Date
    Nov 2002
    Posts
    482
    also you could use a site like no-ip to redirect your ip ect. it will also give you a prog that will update your ip automatically. maybe this is your problem, a change in ip's
    - Trying is the first step towards failure. the moral is never try.
    - It\'s like something out of that twilighty show about that zone.
    ----Homer J Simpson----

  8. #8
    str34m3r
    Guest
    If you don't mind waiting until Monday, I can take a look at the machine at work that I set virtual hosts on and post the httpd.conf file, but I've looked through all the backup files I have here and I can't find that one. Mine was also for two boxes within the same domain, but I don't think that should make a difference for this.

    As best I can remember, it looks something like this:

    Code:
    NameVirtualHost 192.168.1.1
    
    <VirtualHost name1.mydomain.com>
      ServerName name1.mydomain.com
      ServerAlias name1
      DocumentRoot /var/www/html/name1
    </VirtualHost>
    
    <VirtualHost name2.mydomain.com>
      ServerName name2.mydomain.com
      ServerAlias name2
      DocumentRoot /var/www/html/name2
    </VirtualHost>

  9. #9
    Senior Member
    Join Date
    Jun 2002
    Posts
    102
    I'm just about to give up. str34m3r if you still wanna do that just pm me with it on monday .
    Thanks for all your guys help.
    Good Grief

Posting Permissions

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