Skip to content

Instantly share code, notes, and snippets.

@prostosergik
Created January 22, 2014 20:42
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prostosergik/8566981 to your computer and use it in GitHub Desktop.
Save prostosergik/8566981 to your computer and use it in GitHub Desktop.
Script for quick virtual domain creation.
#!/bin/bash
HOST="Unknown";
if [ "$1" != "" ]; then
HOST="$1";
else
echo "Enter hosthame: ";
read HOST;
fi
echo "Creating virtual domain $HOST.ps with allias www.$HOST.ps";
echo "#VirtualHost Config File for host $HOST
<VirtualHost *:80>
ServerName $HOST.ps
ServerAdmin webmaster@localhost
ServerAlias www.$HOST.ps
DocumentRoot /home/prostosergik/WWW/$HOST/Www/
</VirtualHost>" > "/etc/apache2/sites-available/$HOST"
DIR="/home/prostosergik/WWW/$HOST/Www"
mkdir -p $DIR > /dev/null
echo "<?php phpinfo(); ?>" > "$DIR/index.php"
chmod -R 777 "$DIR/../";
echo "127.0.0.1 $HOST.ps www.$HOST.ps" >> /etc/hosts
a2ensite $HOST > /dev/null
apache2ctl restart > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment