Hey guys,
we’re going to add a new virtual host in apache2
1) create a new virtual host file in /etc/apache2/sites-available
$ cd /etc/apache2/sites-available$ touch newhost
2) use your favourite editor to put what follows in that file. Change the document root to wherever you want to put your host. Change the server name to the address where you want to access your host:
<VirtualHost *> ServerName rails DocumentRoot /var/www/newhost/
<Directory /var/www/newhost/>
AllowOverride all Order allow,deny Allow from all
</Directory></VirtualHost>
3) having set up this file, we then need to symlink to it from the sites-enabled directory. Let’s do that now:
$ cd /etc/apache2/sites-enabled$ ln -s ../sites-available/newhost newhost
4) In order to get the apache2 server to display this site when you access it, you’ve got to add this ServerName alias next to 127.0.0.1 in your /etc/hosts file, or your web browser is _not_ going to know where to go when you give it in your address bar. Here’s the beginning of mine:
127.0.0.1 newhost etc...
5) Now we’re pretty well done (so long as I haven’t left a step out). Restart your apache2 with:
$ /etc/init.d/apache2 restart
see you next,
Antonio
ps. Thanks to Siennalizard







