Posted By

craig0990 on 03/29/11


Tagged

Bash site Apache2


Versions (?)

Create new Apache VirtualHost files and /var/www directories


 / Published in: Bash
 

Fairly self-explanator, but:

Expects a directory at /var/www/skeleton with the correct permissions. This is then copied and renamed. Also expects a file named /etc/apache2/sites-available/skeleton which is used to copy the VirtualHost configuration.

  1. #!/bin/sh
  2.  
  3. if [ -z "$1" ]; then
  4. echo "Usage: a2mksite <DOMAIN>"
  5. echo ""
  6. echo "Please supply a domain name"
  7. exit 0
  8. fi
  9.  
  10. cp -R "/var/www/skeleton" "/var/www/$1"
  11. sed -e "s/skeleton/$1/g" "/etc/apache2/sites-available/skeleton" > "/etc/apache2/sites-available/$1.dev"
  12. a2ensite "$1.dev"

Report this snippet  

You need to login to post a comment.