Check if apache vhost_alias, rewrite** module is enabled
sudo a2enmod vhost_alias
sudo a2enmod rewrite
restart/reload apache server when prompted
**REWRITE module is needed on Laravel projects
sudo nano /etc/hosts
On the hosts file, create this record
127.0.0.1 test.dev
The syntax is as follows the IP ADDRESS followed by the ServerName on the above example I created it as test.dev, therefore you can access the server on the browser by typing test.dev
cd /etc/apache2/sites-available/
touch test.dev.conf
nano test.dev.conf
touch test.dev.conf - this will create a .conf file or configuration for the vhost test.dev The syntax is [ServerName].conf , if we created on /etc/hosts a 127.0.0.1 practice.com then our conf file will be practice.com.conf
<VirtualHost *:80>
DocumentRoot /var/www/test.dev
ServerName test.dev
</VirtualHost>
This is the bare syntax when creating VHOST *:80 tells that it will listen to any IP on port 80 DocumentRoot where the root directory for the VHOST ServerName - the name we will access locally, also must be the same in /etc/hosts
sudo a2ensite test.dev.conf
a2ensite [ServerName].conf
sudo a2dissite test.dev.conf
After enabling your VHOST you can now try and access your server on the browser by typing test.dev