Configuring VirtualHost and Host alias on Ubuntu 10.04 Development Box
On my ubuntu 10.04 box, I have apache2 webserver running. Since I get involved in different project over the time, it felt rather awful to access each project via http://localhost/projectname. I configured virtualhost and hosts file on my ubuntu machine to achieve host alias so that I could run the project via host alias like http://projectname/. I will describe how I achieved this.
First I edited httpd.conf located at /etc/apache2/ (Location of httpd.conf may vary. Please figure out the the path to httpd.conf for your system configuration)
I added following lines to httpd.conf file.
<VirtualHost *:80>
ServerName projectname.local
DocumentRoot /path/to/your/project/root
<Directory /path/to/your/project/root >
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Next I edited /etc/hosts file and added the following line to it.
127.0.0.1 projectname.local
Now I restarted the apache server by executing
sudo /etc/init.d/apache2 restart
And now, I could navigate to http://projectname.local/
Note : You should check if you are behind proxy to browse the internet. If your proxy is configured, u should make it sure, requests to projectname.local is served directly by putting projectname.local to ignored hosts list.
Related Article :
http://www.nitesh.com.np/linux/how-to-setup-your-own-linux-home-server-on-ubuntu-with-custom-domain/
[...] Configuring VirtualHost and Host alias on Ubuntu 10.04 Development Box Call me Partner Links [...]