title: Centos 7: Multiple virtual host is not working
body: <p>My server information is </p>
  
  <pre><code>Server version: Apache/2.4.6 (CentOS)
  Server built:   Nov 19 2015 21:43:13
  </code></pre>
  
  <p>I am trying to configure virtual host for 2 different sites: biz.example.com and pin.example.com which are hosted on the same server. There are 2 different folders located under 'var/www/html/' named 'biz' and 'pin' with their respected project files for the above mentioned 2 websites. I am trying to configure it on the below way.</p>
  
  <p>Within /etc/hosts below configuration</p>
  
  <pre><code>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
  ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
  
  xxx.xxx.xxx.xxx biz.example.com
  xxx.xxx.xxx.xxx pin.example.com
  </code></pre>
  
  <p>xxx.xxx.xxx.xxx is replaced by the server IP address.</p>
  
  <p>Within  /etc/httpd/conf/httpd.conf </p>
  
  <pre><code>IncludeOptional sites-enabled/*.conf
  </code></pre>
  
  <p>Now, under /etc/httpd/sites-available there are biz.conf and pin.conf file. I also have the folder sites-enabled under /etc/httpd which has 2 files that points to the biz.conf and pin.conf of sites-available folder using the below command</p>
  
  <pre><code>ln -s /etc/httpd/sites-available/biz.conf /etc/httpd/sites-enabled/biz.conf
  
  ln -s /etc/httpd/sites-available/pin.conf /etc/httpd/sites-enabled/pin.conf
  </code></pre>
  
  <p>biz.conf has the followings </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  ServerName http://biz.example.com/
  ServerAlias http://biz.example.com/
  DocumentRoot "/var/www/html/biz"
  &lt;directory "/var/www/html/biz"&gt;
          Options Indexes FollowSymLinks
          AllowOverride all
          Order Deny,Allow
          Allow from 127.0.0.1
  &lt;/directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>And the configuration within pin.conf file is mentioned as </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  ServerName http://pin.example.com/
  ServerAlias http://pin.example.com/
  DocumentRoot "/var/www/html/pin"
  &lt;directory "/var/www/html/pin"&gt;
          Options Indexes FollowSymLinks
          AllowOverride all
          Order Deny,Allow
          Allow from 127.0.0.1
  &lt;/directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>On this setup, if i try to access <a href="http://biz.example.com/" rel="nofollow noreferrer">http://biz.example.com/</a> , the correct website (biz website) is loading. But if i try to access <a href="http://pin.example.com/" rel="nofollow noreferrer">http://pin.example.com/</a> , then also biz website is loading instead of pin website. Multiple configuration is not working together. </p>
  
  <p>I also tried to merge the virtual configuration of biz.conf and pin.conf within a single file, biz.conf, but it didn't work as well.</p>