Apache Virtual Hosts

Discussion in 'OT Technology' started by arcarsenal, Jun 2, 2003.

  1. arcarsenal

    arcarsenal Guest

    ...was wondering if anyone knows how to set up virtual hosts in apache, running redhat 9 right now. Say I have two dns names , site1.no-ip.com, and site2.no-ip.com. They both point to the same IP address, but how do i make apache know the difference, to where each one points to a different page on my server. When I try to do it, it just brings up a test page, so, somethings going wrong. Any help would be good.
     
  2. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    Ack, if I was at home I could cut and paste my httpd.conf for you :(

    Stupid work firewall blocks terminal services and ssh.
     
  3. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    I need to know that myself. IIS makes this easy, but I need to know Apache too. :hs:
     
  4. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
  5. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    This is from a RedHat9 box I used at school, so this is an Apache 2 config.

    Code:
    #
    # Use name-based virtual hosting.
    #
    #NameVirtualHost *
    NameVirtualHost *:80
    
    
    #
    # 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 *:80>
    #    ServerAdmin [email][email protected][/email]
    #    DocumentRoot /www/docs/dummy-host.example.com
    #    ServerName dummy-host.example.com
    #    ErrorLog logs/dummy-host.example.com-error_log
    #    CustomLog logs/dummy-host.example.com-access_log common
    #</VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin [email][email protected][/email]
        DocumentRoot /var/www/vhosts/example1.com
        ServerName example1.com
        ServerAlias [url]www.example1.com[/url]
        ErrorLog logs/example1.com-error_log
        CustomLog logs/example1.com-access_log common
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin [email][email protected][/email]
        DocumentRoot /var/www/vhosts/example2.com
        ServerName example2.com
        ServerAlias [url]www.example2.com[/url]
        ErrorLog logs/example2.com-error_log
        CustomLog logs/example2.com-access_log common
    </VirtualHost>
    
     
  6. Rob

    Rob OT Supporter

    Joined:
    Jul 6, 2002
    Messages:
    88,630
    Likes Received:
    41
    Location:
    Atlanta, GA
    They give you HTTP proxy that supports CONNECT? :naughty:
     

Share This Page