Single IP multiple websites

Discussion in 'Installation/Configuration' started by RioSif, Mar 9, 2013.

  1. RioSif

    RioSif Member

    Hello,
    I have one ip lets say 1.2.3.4 and lets say 3 websites example1.com, example2.com, example3.com.
    Websites are created with this ip selected at the "IPv4-Address". DNS created. Websites working ok.
    At /etc/httpd/conf/sites-enabled/ i have 000-apps.vhost, 000-ispconfig.conf, 900-example1.com.vhost, 900-example2.com.vhost, 900-example3.com.vhost .
    As i checked when i try to access via the browser the ip 1.2.3.4 it goes to example1.com. I think because of alphabetic sorting. How can i make the ip redirects to example2.com or example3.com?

    Thanks

    PS: Centos 6.3, ISPconfig latest
     
    Last edited: Mar 9, 2013
  2. falko

    falko Super Moderator

    You must use domains/hostnames in your browser, not IP addresses.
     
  3. RioSif

    RioSif Member

    Yes, of course, you are right. That's the correct behavior but what if someone pings example3.com and finds it's ip address and then hits the ip address and sees example1.com instead of example3.com?
    My question is is there a way to control via ispconfig or manually from the configuration of bind9 or httpd or it is just chosen randomly. I just want to know if there is a way. I know the right way to access a website.

    Thanks
     
  4. tahunasky

    tahunasky New Member

    Change the names of your vhost files:

    902-example1.com.vhost, 900-example2.com.vhost, 901-example3.com.vhost

    Apache will load the first one (900) and make it the default for the IP, then load 901, and 902, so if the IP is used it the web browser it will go to 900..

    I myself usually put a _default.vhost file, to do this job.

    You cant control this behavour using ISPConfig.
     
    Last edited: Mar 10, 2013
  5. RioSif

    RioSif Member

    You are right, i thought of this cheat too. I was just looking for a more formal way.
    Anyway, i'll do like that. Thank you!
     

Share This Page