Websites with same domain name, different IP addresses?

Discussion in 'Installation/Configuration' started by cbj4074, May 17, 2012.

  1. cbj4074

    cbj4074 Member

    I apologize if this question has been raised before; I did perform a search (and it returned 12 pages, with no relevant results in the first four).

    I am wondering about the logic behind preventing two websites from having the same domain name -- when the IP addresses on which to listen are different.

    I'm sure someone is thinking, "Why would you ever want to do that?"

    I want to do it because I am migrating a website from one IP address to another IP address -- on the same server/ISPConfig installation.

    Ideally, I would create identical websites -- one on each IP address -- so that once I update the DNS record (hosted externally), it doesn't matter which IP address the site-visitor hits when he visits the domain in question. The user experience should be the same for each IP address.

    Is there a technical reason for which Apache cannot accommodate this setup?

    Wouldn't it be perfectly valid to do something like this in the Apache configuration?

    DocumentRoot /www/example
    DocumentRoot /www/example
    If I try that locally, Apache does not throw warnings/errors, and pages continue to be served from localhost without issue.

    Thanks for any insights.
  2. falko

    falko Super Moderator ISPConfig Developer

    I'm sure this is technically possible, but it's just a decision we made to prevent users from creating the same web site twice.
  3. cbj4074

    cbj4074 Member

    Thank you for the prompt reply, Falko.

    Would you consider this to be a valid "feature request"? Due to the fact that ISPConfig forbids this configuration, I now have to:

    1.) Move the site in question to a completely different physical server (even though I have plenty of unused IP addresses on the current server). This is a major headache because we don't allow remote MySQL connections, so a second database has to be stood-up on the new server, and the data in each DB merged later on. (Replication would be ideal, but is outside the scope of this change.)

    2.) Update the DNS records to point to the other server.

    3.) Once look-ups are resolving to the new IP address (on the separate physical box), change the domain in the Website tab on the original server.

    4.) Update DNS to point back to the original server (but different IP address).

    5.) Delete the "temp" site.

    It seems that need to move a website from one IP address to another, on the same server, should be fairly common, especially given the lack of ubiquitous support for SNI at this time.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    If you select * in the website settings, then you can access the site from both IP addresses.

    If thats not a option, then just create a copy of the vhost file of the existing site in /etc/apache2/sites-available, the name of the file does not matter, edit the ip address inside the file and save it. Then create a symlink in /etc/apache2/sites-enabled/ pointing to that file and restart apache.
  5. cbj4074

    cbj4074 Member

    Thanks for the reply, Till.

    I require a dedicated IP address for SSL on this particular domain. And this box is configured to support SNI, so there are dozens of other websites that are bound to all interfaces ("*"), each with a unique/proper SSL certificate.

    Does that mean selecting "*" this is not an option in this particular case? What if I change all of the sites that leverage SNI to be bound to a specific IP address (other than the new one I just added to support SSL on this site).

    If not, I will try the other steps you suggested. They make sense.

    Thanks again!
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    If sni works or not depends mostly on the briwsers that are used to access the sites, especially IE was very late in implementing SNI. If SSL by SNI is fine for you, then you can use * for all sites.
  7. cbj4074

    cbj4074 Member

    Thanks, Till.

    As a bit of background, I just added a second IP address to this server. I'm already using SNI for about a dozen sites on this box, and it works as well as expected as far as the server is concerned (the lack of browser support [mostly IE and Android] is another issue). Each of those sites has "*" selected for the IP address.

    I would like to continue using SNI on all of the existing sites, except one. I need a particular site to have a dedicated IP address, and SSL (SNI is not acceptable for this site).

    Should I leave all of the existing sites set to "*" and change only the one site that requires a dedicated IP address to the corresponding literal IP (within the ISPConfig interface)?
    Last edited: May 21, 2012
  8. cbj4074

    cbj4074 Member

    Hi, everyone. I'm still wondering how to do this:

    As a bit of background, I have one IP address created in ISPConfig. I have several websites that are bound to "*" in ISPConfig's Website -> Domain tab (no website is bound to the literal IP address).

    How can I use SSL for the one website that I want to be the "primary", without the attendant SNI issues with older browsers (such as IE6), but at the same time use SNI (each site with its own self-signed certificate) for all other domains on the same IP address?

    In other words, if I type the server's IP address in my browser's URL field, with the https protocol, I want to hit the "primary" site to which the proper SSL certificate is issued. Naturally, I want to hit the same primary site when I enter it's domain name (with https). Finally, I want to hit the various other sites that are hosted at the same IP address by domain name, with https, and leverage SNI for each.

    The basis of my concern is that I have enabled SSL for sites other than the primary domain, and things have not behaved as expected. I have been directed to the wrong website whenever I try to connect over SSL.

    Thanks for any help!
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Dont mix * and IP addresses in websites, thsi will cause redirect failures in apache. Either use * for all sites or select the IP address for all sites but dont mix that as a IP address is always a stroinger match then a wildcard in apache.

    Assign a separate IP address to the site. This IP may not be shared with any other website.

Share This Page