Kamis, 05 Juni 2014

Setting Up Virtual Hosts on Local Ubuntu

Create a virtual host on Ubuntu server is done in the following way;

1. Go to folder /etc/apache2/conf.d/ and create a new file. Example; mylaravel.conf

<VirtualHost 127.0.0.9>
    DocumentRoot "/home/kenzominang/mylaravel/public" ServerName virtual_ok
    <Directory "/home/kenzominang/mylaravel/public">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
    </Directory>
</VirtualHost>


2. Open /etc/hosts and add this line below

127.0.0.10 mylaravel


3. Restart apache to make it work

$ sudo /etc/init.d/apache2 restart