Archive for June, 2009

Adding Virtual Domains — The Easy Way (Ubuntu)

I wrote this script out of my need for a quick method of adding virtual domains. I hope you find this to be of great use.

create a file named addomain

  1. sudo vim /usr/bin/adddomain

Place this in your file:

  1. #!/bin/bash
  2. #Edit the following e-mail address:
  3. email="your@email.address"
  4. ipaddress=`ifconfig eth0 | grep inet | awk ‘{print $2}’ | sed ‘s/addr://’ | grep .`
  5. domain=$1
  6. file="/etc/apache2/sites-available/$domain"
  7. if [ -z $domain ]; More >