title: Multiples VirtualHost for Symfony3 projects in AWS development environment
body: <p>We have a problem with access to multiple Symfony3 projects that are in different folders and  targeted to the same IP address but in different ports on EC2, for example:</p>
  
  <p>project1:</p>
  
  <ul>
  <li>52.1.1.1:8080/login</li>
  <li>/var/www/html/projects/project1/</li>
  </ul>
  
  <p>project2: </p>
  
  <ul>
  <li>52.1.1.1:8181/login</li>
  <li>/var/www/html/projects/project2/</li>
  </ul>
  
  <p>Happens that when entering the <strong><em>Project 1</em></strong> (52.1.1.1:8080) it is displayed correctly, but afterward when accessing to <strong><em>Project 2</em></strong> (52.1.1.1:8181), this fails, strangely deploys the information from <strong><em>Project 1</em></strong>.</p>
  
  <p>In another scenario, when rebooting the apache service and entering the <strong>Project2</strong> (52.1.1.1:8181) all is displayed correctly, but if after entering in the <strong>Project2</strong>, we enter the <strong>Project 1</strong> (52.1.1.1:8080) the information from <strong>Project2</strong> is displayed, instead of that of the <strong>Project 1</strong>.</p>
  
  <p>Ports <strong>8080</strong> and <strong>8181</strong> are open.</p>
  
  <p>Apache configuration on the server is the following:</p>
  
  <pre><code>Listen 8181
  &lt;VirtualHost *:8181&gt;
      DocumentRoot    "/var/www/html/projects/project1/web"
      DirectoryIndex  app.php
      &lt;Directory "/var/www/html/projects/project1/web"&gt;
          Require all granted
          Order allow,deny
          Allow from All    
          &lt;IfModule mod_rewrite.c&gt;
              Options -MultiViews
              RewriteEngine On
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteRule ^(.*)$ app.php [QSA,L]
          &lt;/IfModule&gt;
      &lt;/Directory&gt;
       &lt;Directory /var/www/html/projects/project1&gt;
             Options FollowSymlinks  
      &lt;/Directory&gt;
      &lt;Directory /var/www/html/projects/project1/web/bundles&gt;
        &lt;IfModule mod_rewrite.c&gt;
         RewriteEngine Off
        &lt;/IfModule&gt;
      &lt;/Directory&gt;
      CustomLog  /var/www/html/projects/project1/var/logs/reg-access.log combined
      ErrorLog   /var/www/html/projects/project1/var/logs/reg.error.log
  &lt;/VirtualHost&gt;
  
  Listen 8080
  &lt;VirtualHost *:8080&gt;
      DocumentRoot    "/var/www/html/projects/project2/web"
      DirectoryIndex  app.php
      &lt;Directory "/var/www/html/projects/project2/web"&gt;
          Require all granted
          Order allow,deny
          Allow from All    
          &lt;IfModule mod_rewrite.c&gt;
              Options -MultiViews
              RewriteEngine On
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteRule ^(.*)$ app.php [QSA,L]
          &lt;/IfModule&gt;
      &lt;/Directory&gt;
      &lt;Directory /var/www/html/projects/project2&gt;
             Options FollowSymlinks
      &lt;/Directory&gt;
      &lt;Directory /var/www/html/projects/project2/web/bundles&gt;
        &lt;IfModule mod_rewrite.c&gt;
         RewriteEngine Off
        &lt;/IfModule&gt;
      &lt;/Directory&gt;
      CustomLog  /var/www/html/projects/project2/var/logs/reg-rm.log combined
      ErrorLog  /var/www/html/projects/project2/var/logs/reg.error.log
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Any help or ideas about what happens?</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>To access the Project 1, logs the following error:</p>
  
  <p>[2016-08-17 07:33:12] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException: "Error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target" at /var/www/html/projects/<strong>project2</strong>/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php line 31 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 0): Error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target at /var/www/html/projects/<strong>project2</strong>/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php:31)"} []</p>
  
  <p>"Vendors" is referenced strangely to another project</p>