Created
January 22, 2014 20:42
-
-
Save prostosergik/8566981 to your computer and use it in GitHub Desktop.
Script for quick virtual domain creation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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