title: Setup an apache Virtual Hosts on Debian 7
body: <p>I tried to setup an apache virtual host on a fresh debian 7 installation like following:</p>
  
  <h3>applied steps</h3>
  
  <p>1.Install apache server:</p>
  
  <pre><code>apt-get install apache2
  </code></pre>
  
  <p>2.create my new derictory:</p>
  
  <pre><code>mkdir -p /var/www/newsite.com/httpdocs
  </code></pre>
  
  <p>3.give the required permissions to the virtual host</p>
  
  <pre><code>chown -R $USER:$USER /var/www/newsite.com/httpdocs
  
  chmod -R 755 /var/www
  </code></pre>
  
  <p>4.create a simple index file to test the results:</p>
  
  <pre><code>nano /var/www/newsite.com/httpdocs/index.html
  </code></pre>
  
  <p>5.enable the site:</p>
  
  <pre><code>   cp /etc/apache2/sites-available/default /etc/apache2/sites-available/newsite.com
  </code></pre>
  
  <p>open the new config file to edit it:</p>
  
  <pre><code>nano /etc/apache2/sites-available/newsite.com
  </code></pre>
  
  <p>add ServerName,ServerAlias and DocumentRoot:</p>
  
  <pre><code>ServerName newsite.com
  ServerAlias www.newsite.com
  DocumentRoot /var/www/newsite.com/httpdocs
  </code></pre>
  
  <p>activate the host:</p>
  
  <pre><code>a2ensite newsite.com
  </code></pre>
  
  <p>and then restart apache:</p>
  
  <pre><code>service apache2 restart
  </code></pre>
  
  <h3>obtained result</h3>
  
  <p>I can now access my index file through the web browser but only when I type:</p>
  
  <pre><code>Server_IP/newsite.com/httpdocs
  </code></pre>
  
  <h3>Question</h3>
  
  <p>I want to access my virtual host directly by typing newsite.com in my web browser, what step is missing to achieve this and itis possible to point to a specific file(index.html or index.php )as a default starting file for the virtual host?</p>
  
  <h3>EDIT:</h3>
  
  <p>content of config file:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
          ServerAdmin webmaster@localhost
          ServerName newsite.com
          ServerAlias www.newsite.com
          DocumentRoot /var/www/newsite.com/httpdocs
          &lt;Directory /&gt;
                  Options FollowSymLinks
                  AllowOverride None
          &lt;/Directory&gt;
          &lt;Directory /var/www/&gt;
                  Options Indexes FollowSymLinks MultiViews
                  AllowOverride None
                  Order allow,deny
                  allow from all
          &lt;/Directory&gt;
  
          ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
          &lt;Directory "/usr/lib/cgi-bin"&gt;
                  AllowOverride None
                  Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                  Order allow,deny
                  Allow from all
          &lt;/Directory&gt;
  
          ErrorLog ${APACHE_LOG_DIR}/error.log
  
          # Possible values include: debug, info, notice, warn, error, crit,
          # alert, emerg.
          LogLevel warn
  
          CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>