title: apache2 config for domain + subdomain
body: <p>I have three domains:</p>
  
  <ul>
  <li>example.com</li>
  <li>www.example.com</li>
  <li>api.example.com</li>
  </ul>
  
  <p>And this is my config:</p>
  
  <p>000-default.conf:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
          DocumentRoot /var/www
          ServerName example.com
          ServerAlias www.example.com
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>api.conf:</p>
  
  <pre><code>LoadModule proxy_module modules/mod_proxy.so
  LoadModule proxy_http_module modules/mod_proxy_http.so
  
  &lt;VirtualHost *:80&gt;
    ProxyPreserveHost On
    ProxyRequests Off
    ServerName api.example.com
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>But when I access to api.example.com, I'm going to example.com instead of real api.example.com (should be a proxy to my server)</p>
  
  <p>why is my first conf matching with api.example.com? what is the problem? thanks!</p>