As a web developer I need to juggle a number of projects on my development machine all at once. The simple way to get around accessing these various sites is to set up a number of subdomains under localhost, one for each project. In other words:
- http://project3.localhost/ …
So how do we go about doing this then?
First, edit your /etc/hosts file by adding the following line:
Next, create a new configuration file in /etc/apache2/sites-available/ using:
gksudo gedit /etc/apache2/sites-available/project1
In this configuration file, add the following:
Options Indexes FollowSymLinks MultiViews +Includes
allow from all
Save the file, and then run the following:
sudo a2ensite project1
Finally restart the Apache Server.
sudo /etc/init.d/apache2 restart
And there you go. You should now be able to hit http://project1.localhost from your browser. Nice! :)
(Ubuntu 10.10 Maverick Meerkat)