When hostname equals domainname

Discussion in 'Installation/Configuration' started by tomnhanni, Nov 15, 2013.

  1. tomnhanni

    tomnhanni New Member

    Debian 7

    Setup using this Tutorial

    I might have made a mistake and set the hostname to a vhost domain name ie "mydomain.com"

    Heres my issue

    I setup a Website in ISPConfig for mydomain.com and then uploaded the website files to the correct vhost DocumentRoot in this case /var/www/clients/client1/web1/web

    But now if i access http://mydomain.com I get the standard "it works" because the /etc/apache2/sites-available/default has DocumentRoot /var/www/

    If I access http://www.mydomain.com the correct web site shows because I set the automatic subdomain to www in the sites config in ISPConfig.

    It seems that Apache overrides the vhost DocumentRoot if the machines hostname is mydomain.com it uses /etc/apache2/sites-available/default
    Can anyone confirm this behavior?

    I am afraid to change the hostname because it will be a pain to reconfigure lots of services like duply backup as they all use the hostname and could break.

    Is there some other way to fix this?

    -- Tom
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    the hostname of the server may never be a domain that you use for web or email. Like it is described in the guide, the hostname should be something like server1.example.com and not example.com. If you would use example.com as hostname, you wont be able to use this domain for email or web services.

    So the way to fix this is that you cahnge the hostname to be a subdomain of your current domain in /etc/hosts, /etc/hostname, /etc/mailname and /etc/postfix/main.cf
  3. tomnhanni

    tomnhanni New Member

    Thank you for your quick answer.

    Yes I realized my mistake afterwards.

    Is it "dangerous" to change the hostname? I read that lots of services specifically automated duply backup will complain about the hostname change.
    I'm just wondering if its worth the hassle?

    If it was your server would you leave it? :eek:
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I can only speak for the services installed as part of te perfect setup guide as I dont know which additional software is installed. for the perfect setup, it is uncritical to change the hostname, just change it wherever it occurs in these files, run "/etc/init.d/hostname start" and restart apache and postfix (or restart the server).

    If you need to use the domain for a website or email, then reconfigure it. If you think that you can live with the fact that the domain is "blocked" somehow, then you can leave it as it is. It is not negative in general to use a full domain as hostname for other domains hosted on that server, the problem is just that you cant use this domain for anything else then.

Share This Page