Like a lot of people, I have one server. Its quite a powerful box and I do pretty much everything on it.
I recently needed to run another site with its own domain name on the same box which has only one ip address (obviously).
Using virtual hosts with apache is really easy and allows you to host two completely different directories anywhere on your server as long as the www-data user is able to read the files, you’re good to go.
1) Copy over the default file already in your sites-available dir to another file (cp default wordpress)
2) Edit the wordpress file and change the ServerName directive as well the DocumentRoot directive to the domain you will use and the absolute path on your server to where you are storing your htdocs you want to serve out from that domain.
3) Edit any other settings you want modified..you really don’t need them since they already exist with your other virtual host (the default one)
4) Take a look below to see what mine looks like and compare yours..*
ServerName scriptthe.net ServerAdmin [email protected] DocumentRoot /var/www/scriptthenet Options FollowSymLinks AllowOverride None
So now I can setup a symlink from sites-enabled to the wordpress file I have just created in sites-available.
cd sites-enabled ln -s ../sites-available/wordpress wordpress
Now restart apache and visit your domain and you should be greeted with the index file you created in the directory you want hosted on that domain.
Visit the official documentation for more information => http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Another Great site for adding mods is: http://www.debuntu.org/book/export/html/72