Default Website

Discussion in 'Installation/Configuration' started by Nilpo, Jul 31, 2013.

  1. Nilpo

    Nilpo Member HowtoForge Supporter

    Using the perfect server setup and ISPConfig 3, how can I set up a default website? I have a domain pointing to my server that hosts my default site. However, if someone accesses my site by IP (as happens when domain is removed while using outside DNS records) it redirects to the most recently added site. I'd like to have this redirect back to my default site instead. Is there anyway to configure this from within ISPC3?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Click on new website, enter "000default.tld" in the domain field and click on save.

    Its not the moszt recent site, its the site that comes first in alphabet and for that reason you can create a default site by entering a domain name that must always be first in alphabet. The domain name does not has to exist in dns.
     
  3. Nilpo

    Nilpo Member HowtoForge Supporter

    Can I do this as an aliasdomain so that I can point it to the existing webroot of defaultsite.com? Or does it have to be a site? I could always use .htaccess to redirect all requests.
     
  4. Nilpo

    Nilpo Member HowtoForge Supporter

    I've decided it's probably more appropriate to add a 000default.tld as a site and then add defaultdomain.com as an aliasdomain to that site. Seems more semantic to me that way.
     
  5. Nilpo

    Nilpo Member HowtoForge Supporter

    Ok, I renamed my default site to "000default.tld". I have added defaultdomain.com as an aliasdomain to that site. The site is properly accessible via my domain name. However, accessing my server by IP still redirects me to the same site as before, not the 000default.tld web root as expected.

    The site it is loading was the first alphabetically before, but the 000default.tld site is first now.

    Any ideas why this is still happening? I've tried clearing browser caches, different browsers, etc. It's definitely something in the server config.

    One thing to note: I renamed an existing site to 000default. Do I need to actually create a new site altogether to make this work? Both should make the same changes to http.conf, right?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Ensure that you selected the same value in the IP address field of the default site then the value that you selected in the site that you are seeing at the moment as default.
     
  7. Nilpo

    Nilpo Member HowtoForge Supporter

    Both sites are just showing a wildcard for the IP address.

    I do have two IP addresses on this server. One IP points to my ISPC3 installation and one IP points to and instance of Lighttpd. I manually edited http.conf to force Apache to listen on one interface.

    I tried going into the System tab and manually adding my apache IP address to ISPC3. Then I edited the "000default.tld" to use the manually added IP instead of a wildcard. It still serves the incorrect site when I access it via a web browser.
     
  8. Nilpo

    Nilpo Member HowtoForge Supporter

    Adding the manual IP broke all of my sites. I've removed that and corrected the problems.

    All of my vhosts use *:80. I use Listen xx.xx.xx.xx:80 in my httpd.conf file to route apache traffic on that interface.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats the normal behaviour of the apache webserver. A IP address is always a stronger match then *, so you should not mix * and IP based vhosts on a server. Either use * for all vhosts or the IP address for all vhosts.
     
  10. Nilpo

    Nilpo Member HowtoForge Supporter

    Yes. I figured that out. I've gone back now and all of my vhosts are using * instead.

    However, accessing my server by IP still results in the wrong site being shown. Apache doesn't seem to like "000default.tld" as a domain name.

    All of the conf files in sites-available are correct. All are using the same naming convention for vhosts. There is no "_default_" vhost on port 80. Apache should default to the first site loaded which is 000default.tld but instead it skips over it and loads the site whose domain name begins with the letter a.

    I could manually add an IP to the configuration and change vhosts to use IP matches for each domain. That should let me use a "_default_" vhost, but that seems like a lot of work for a workaround. Am I missing something else?
     
  11. Nilpo

    Nilpo Member HowtoForge Supporter

    I found the problem, I think.

    Under sites-enabled, the naming of the symlinks seems to be causing the domains to load in the wrong order.

    100-axxxxx.biz.vhost is loading before 900-000default.tld.vhost.

    In fact, I have another domain also using 100. Is there a reason why these aren't 900 like all of the others?
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    You have activated other options then what I described. The 900 order is used if you changed the auto subdomain setting to * instead of leaving it on its default value.

    To create a auto subdomain, just enter 000default.tld in the domain field and press save. Do not set any other values.
     
  13. Nilpo

    Nilpo Member HowtoForge Supporter

    That did it.

    I changed the auto-subdomain back to "www" and the vhost conf file has been renamed to start with 100. It now loads first and all is working properly.

    Thanks for your help and patience!
     

Share This Page