title: Apache vhost directory never used
body: <p>I’m setting a new server on Debian 9, but this time I’m struggling with the vhosts.</p>
  
  <p>Basically, the vhosts never reach their DocumentRoot, but fallback on the default DocumentRoot (<code>/var/www/html</code>). As this is usually a simple matter of finding the right configuration, this time I don’t get it to work.</p>
  
  <p>I reduced the conf files to the strict minimum to work on the problem. Let’s take 2 vhosts conf examples:</p>
  
  <pre><code>&lt;VirtualHost 127.0.0.1:80&gt;
      ServerName www.site1.com
      ServerAlias www.site1.com
      ServerAdmin contact@test.com
  
      DocumentRoot /var/www/site1
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost 127.0.0.1:80&gt;
      ServerName www.site2.com
      ServerAlias www.site2.com
      ServerAdmin contact@test.com
  
      DocumentRoot /var/www/site2
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>In this case, going either on <code>www.site1.com</code> or <code>www.site2.com</code> will fall to the default page on <code>/var/www/html</code>.</p>
  
  <p>If I’m changing one of the <code>120.0.0.1:80</code> to <code>*:80</code>, it is immediately set as the working vhost. But if I set both on <code>*:80</code>, it will fall on the first in the list.</p>
  
  <p>Meaning if I have this:</p>
  
  <pre><code>&lt;VirtualHost 127.0.0.1:80&gt;
      ServerName www.site1.com
      ServerAlias www.site1.com
      ServerAdmin contact@test.com
  
      DocumentRoot /var/www/site1
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      ServerName www.site2.com
      ServerAlias www.site2.com
      ServerAdmin contact@test.com
  
      DocumentRoot /var/www/site2
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p><code>www.site1.com</code> and <code>www.site2.com</code> will lead to <code>/var/www/site2</code>. Same the other way.</p>
  
  <p>But if I do this :</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName www.site1.com
      ServerAlias www.site1.com
      ServerAdmin contact@test.com
  
      DocumentRoot /var/www/site1
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      ServerName www.site2.com
      ServerAlias www.site2.com
      ServerAdmin contact@test.com
  
      DocumentRoot /var/www/site2
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Then <code>www.site1.com</code> and <code>www.site2.com</code> will fall on <code>www.site1.com</code>.</p>
  
  <p>I triple checked my <code>apache.conf</code>, <code>ports.conf</code>. They’re both on the default settings after a fresh install.</p>
  
  <p>All the usual answers on "solved" similar posts have been tried and checked:
  <code>apachectl -t</code> returns a <code>Syntax OK</code>.
  All conf files end with <code>.conf</code>.
  The chmod have been set to various tries, including 755, 775 and 777.
  The matching user is set on the directories too.
  I tried to sudo everything, restarting, reloading, etc.
  I did reboot the server.
  I’ve set the log on debug, but I can’f find everything wrong in it (though I’m not sure what to look for).</p>
  
  <p>Just in case, here’s my <code>/etc/hosts</code>:</p>
  
  <pre><code>127.0.0.1   localhost
  127.0.1.1   sd-*****.dedibox.fr sd-****
  # The following lines are desirable for IPv6 capable hosts
  
  ::1     localhost ip6-localhost ip6-loopback
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  </code></pre>
  
  <p>and hostname:</p>
  
  <pre><code>sd-*****
  </code></pre>
  
  <p>I really don’t know what’s going on now. Thanks for any hint.</p>