Setting ServerName to suppress Apache warning message with multiple domains

8,317

You can just set it to localhost. Edit /etc/apache2/conf.d/httpd.conf:

ServerName localhost

The ServerName directive can be use in two contexts: server config or virtual host.

  • In server config context, ServerName directive is used when creating redirection URLs.
  • In virtual host context, ServerName directive is used to uniquely identify a virtual host.

So you must set ServerName inside a VirtualHost section for each domain configuration to identify two domains. The global value will make the warning message disappear and doesn't affect the identity between two domains.

Share:
8,317

Related videos on Youtube

vaindil
Author by

vaindil

Updated on September 18, 2022

Comments

  • vaindil
    vaindil 4 months

    When I restart/reload/whatever apache2 (2.4) on Ubuntu Server 14.10, I get the error message that the server could not determine the FQDN. I had this set previously, no big deal, but I now have two domain names on the server managed by separate VirtualHost config files. What should I set ServerName to in apache2.conf to suppress the error since I have multiple domain names? Should it globally be the server's IP address but set individually in the VirtualHost configs the proper way?

    • cuonglm
      cuonglm almost 8 years
      Just set it to localhost.
    • vaindil
      vaindil almost 8 years
      @cuonglm Well, that's simple, I didn't even think about that. If you post as an answer I'll accept it. Thank you!