title: How to change apache domain name(locally) for a laravel site on ubuntu?
body: <p>Good day guys in my application I want to change the normal <code>http://127.0.0.1:8000/</code> that laravel uses to serve sites when one runs <code>php artisan serve</code> to <code>example.com</code> and this should have sub domains like <code>app1.example.com</code> and <code>app2.example.com</code>.</p>
  
  <p>In the main time I have tried to create a virtual host for my site by creating a <strong>.conf</strong> file inside of <code>etc/apache2/sites-available/example.com.conf</code> and here is how it looks:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  
  
      ServerAdmin webmaster@example.com
      ServerName example.com
      ServerAlias www.example.com
      DocumentRoot /home/tangaye/sites/example/public/index.php
  
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>After doing that I enable the virtual host I created by running <code>sudo a2ensite example.com.conf</code> and <code>sudo service apache2 reload</code> to reload apache2 configuartions and <code>sudo service apachIe2 restart</code> from the on I added the address my site points to in <code>/etc/hosts</code>:</p>
  
  <pre><code>127.0.0.1   localhost    example.com
  127.0.1.1   tangaye
  </code></pre>
  
  <p>After doing all this when I run <code>php artisan serve</code> from my laravel site directory I still see my site being launch like this:</p>
  
  <blockquote>
    <p>Laravel development server started: <a href="http://127.0.0.1:8000" rel="nofollow noreferrer">http://127.0.0.1:8000</a></p>
  </blockquote>
  
  <p>After all I have done I expected to rather see this:</p>
  
  <blockquote>
    <p>Laravel development server started: example.com</p>
  </blockquote>
  
  <p>The worst thing is when I try to access example.com in my browser it tends to search for it on the internet.</p>
  
  <p>At this point I don't really understand what really I'm doing. All I want is to be able to customize my site domain name <strong>LOCALLY</strong> and add other sub domains.
  Will appreciate any help. Thanks!</p>