title: How to run multiple sites on one apache instance
body: <p>Spent hours going in circles following every guide I can find on the net.</p>
  
  <p>I want to have two sites running on a single apache instance, something like this -
  192.168.2.8/site1
  and
  192.168.2.8/site2</p>
  
  <p>I’ve been going round in circles, but at the moment I have two conf files in ‘sites-available (symlinked to sites-enabled)’ that look like this-</p>
  
  <pre><code>&lt;VirtualHost *:2000&gt;
  
  ServerAdmin webmaster@site1.com
  ServerName site1
  ServerAlias site1
  
  # Indexes + Directory Root.
  DirectoryIndex index.html
  DocumentRoot /home/user/site1/
  
  # CGI Directory
  ScriptAlias /cgi-bin/ /home/user/site1/cgi-bin/
  
  Options +ExecCGI
  
  # Logfiles
  ErrorLog /home/user/site1/logs/error.log
  CustomLog /home/user/site1/logs/access.log combined
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;VirtualHost *:3000&gt;
  
  ServerAdmin webmaster@site2.com
  ServerName site2
  ServerAlias site2
  
  # Indexes + Directory Root.
  DirectoryIndex index.html
  DocumentRoot /home/user/site2/
  
  # CGI Directory
  ScriptAlias /cgi-bin/ /home/user/site2/cgi-bin/
  
  Options +ExecCGI
  
  # Logfiles
  ErrorLog /home/user/site2/logs/error.log
  CustomLog /home/user/site2/logs/access.log combined
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>http.conf looks like this-</p>
  
  <pre><code>NameVirtualHost *:2000
  NameVirtualHost *:3000
  </code></pre>
  
  <p>At the moment I’m getting this error-</p>
  
  <pre><code>[error] VirtualHost *:80 — mixing * ports and non-* ports with a NameVirtualHostaddress is not supported, proceeding with undefined results
  </code></pre>
  
  <p>Ports.conf looks like this – (although no guides have mentioned any need to edit this)</p>
  
  <pre><code>NameVirtualHost *:80
  
  Listen 80
  &lt;IfModule mod_ssl.c&gt;
  # If you add NameVirtualHost *:443 here, you will also have to change
  # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
  # to &lt;VirtualHost *:443&gt;
  # Server Name Indication for SSL named virtual hosts is currently not
  # supported by MSIE on Windows XP.
  Listen 443
  &lt;/IfModule&gt;
  
  &lt;IfModule mod_gnutls.c&gt;
  Listen 443
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Can anyone give some simple instructions to get this running? Every guide I’ve found  says to do it a different way, and each one leads to different errors. I'm obviously doing something wrong but have found no clear explanation of what that might be.</p>
  
  <p>Just want one site accessible on port 2000 and the other accessible on port 3000 (or whatever, just picked those ports to test with).</p>
  
  <p>I’m running Ubuntu server 12.04…</p>
  
  <p>=============</p>
  
  <h1>EDIT</h1>
  
  <p>Followed another 'guide'...</p>
  
  <p>I've now set this up in sites-available:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      DocumentRoot "/home/user/site1/"
      ServerName 192.168.2.10/site1
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      DocumentRoot "/home/user/site2/"
      ServerName 192.168.2.10/site2
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Have set this in apache2.conf:</p>
  
  <pre><code>ServerName site1
  ServerName site2
  </code></pre>
  
  <p>Have added this to ports.conf:</p>
  
  <pre><code>Listen 192.168.2.10:80
  </code></pre>
  
  <p>==============</p>
  
  <h1>EDIT</h1>
  
  <p>It now works, I put this in a conf file in site-enabled:</p>
  
  <pre><code>&lt;VirtualHost *:81&gt;
      DocumentRoot "/home/user/site1/"
      ServerName site1
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:82&gt;
      DocumentRoot "/home/user/site2/"
      ServerName site2
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I have this in ports.conf:</p>
  
  <pre><code>Listen *:80
  Listen *:81
  Listen *:82
  </code></pre>
  
  <p>I have this in apache2.conf:</p>
  
  <pre><code>ServerName site1
  ServerName site2
  </code></pre>
  
  <p>I didn't find this in any guides I just got it working through an entire day of trial and error so I don't know if this is a good solution. But it's at least working how I want it to now.</p>