The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

when going to http://sharedip it goes to the first site listed in httpd config

Discussion in 'General Discussion' started by Nathan D., Aug 23, 2004.

  1. Nathan D.

    Nathan D. Well-Known Member

    Joined:
    Mar 21, 2004
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Virginia
  2. cPanelBilly

    cPanelBilly Guest

    Add whatever you would like to be there as the 1st virtualhost.
     
  3. Nathan D.

    Nathan D. Well-Known Member

    Joined:
    Mar 21, 2004
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Virginia
    Well, is there a better solution than that?
     
  4. cPanelBilly

    cPanelBilly Guest

    Unfortunatly not, this is how Apache works.
     
  5. zentity

    zentity Well-Known Member

    Joined:
    Jun 16, 2004
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    If you can work out all of your shared IP's on the machine, just add an include to apache with a dummy VirtualHost for each IP. Add that to the top of the virtualhost section of your httpd.conf

    eg

    Create the file : httpd.conf.shared

    NameVirtualHost 123.123.123.123:80
    <VirtualHost 123.123.123.123>
    ServerName default1.your_server_name.com
    DocumentRoot /usr/local/apache/htdocs
    </VirtualHost>

    NameVirtualHost 123.123.123.124:80
    <VirtualHost 123.123.123.124>
    ServerName default2.your_server_name.com
    DocumentRoot /usr/local/apache/htdocs
    </VirtualHost>


    The add an Include into httpd.conf (before your other VirtualHosts)

    Include /usr/local/apache/conf/httpd.conf.shared

    With servers with a lot of resellers that use their own shared IP's - that can be easier to manage than going into httpd.conf and adding them individually - You could make a script up to configure the default VirtualHosts (The ones you see when you go to your shared IP addresses http://123.123.123.123) quite easily.
     
    #5 zentity, Aug 24, 2004
    Last edited: Aug 24, 2004
  6. GOT

    GOT Get Proactive!

    Joined:
    Apr 8, 2003
    Messages:
    900
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Norfolk, VA
    cPanel Access Level:
    DataCenter Provider
    We always make sure that the first virtualhost entry for the main server IP is set to the hostname and to point to /usr/local/apache/htdocs. If you do this, then the ~username portion will work fine.
     
  7. perlchild

    perlchild Well-Known Member

    Joined:
    Sep 1, 2002
    Messages:
    279
    Likes Received:
    0
    Trophy Points:
    16
    here's a deadpan answer

    If you enter the sharedip, and it is shared(it belongs to several names at once) how can the server guess which one?
     
  8. zentity

    zentity Well-Known Member

    Joined:
    Jun 16, 2004
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    The server doesn't guess, it will use the first one First VirtualHost container for that IP) that it comes to within the httpd.conf file if you access via IP address.

    For further info on how VirtualHosts work with regards shared ips (Name Based), the apache docs should help there to understand how that works: http://httpd.apache.org/docs/vhosts/index.html
     
    #8 zentity, Aug 27, 2004
    Last edited: Aug 27, 2004
Loading...

Share This Page