#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    313
    Rep Power
    30

    Using Both Name-Based Virtual Host and IP Based


    Hey all,

    Just a quick question to verify if I am doing this correctly. I have a server that I want to host a few domains, although one of them will need an SSL cert. For that reason, that domain will be given it's own IP but the remainder of the domains can share. My understanding is kind of a mix between IP and Name Based Virtual Hosts.

    My structure is kind of as follows - it seems to work alright thus far in development but just wanted to check here in case I'm going about it the wrong way or if this will introduce some issues I'm unaware of.

    Code:
    // first set up for the shared space
    NamedVirtualHost *:80
    
    <VirtualHost *:80>
    ServerName blah
    blah blah
    </VirtualHost>
    
    // everything above here is just as in examples for setting up named virtual host - even includes a default site for when specified by IP only.  Now do IP specific stuff
    
    NamedVirtualHost #.#.#.#:80
    <VirtualHost #.#.#.#:80>
    Specifics for the domain that needs SSL cert
    </VirtualHost>
    Seem right? I couldn't find any examples that did both as they either go one way or another. It seems to work and seems as if the #.#.#.#:80 overrides the previous *:80 being used. I still wanted to use * and not have to manually specify the public shared IP every time, but just don't want it to apply to the IP specific stuff.
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    I'm not aware of a "NamedVirtualHost" directive. Perhaps you mean "NameVirtualHost"?

    Otherwise that looks fine.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo