Last active
September 21, 2015 21:20
-
-
Save tiagopassinato/8e9c5a648109688aab67 to your computer and use it in GitHub Desktop.
Quickly add apache vhost
This file contains hidden or 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 | |
echo "Creating VHOST $1" | |
echo "Creating folder /home/sites/$1" | |
mkdir /home/sites/$1 | |
echo "Log dir & Public HTML" | |
mkdir /home/sites/$1/logs | |
mkdir /home/sites/$1/htdocs | |
mkdir /home/sites/$1/cgi-bin | |
echo "VHOST Files" | |
cp modelo_vhost /etc/apache2/sites-available/$1 | |
sed -i -- "s/{{host}}/$1/g" /etc/apache2/sites-available/$1 | |
echo "default index.html" | |
echo "It Works" > /home/sites/$1/htdocs/index.html | |
echo "Permissions" | |
chown -R username:www-data /home/sites/$1 | |
echo "Restart Apache" | |
a2ensite $1 | |
apache2ctl restart |
Author
tiagopassinato
commented
Sep 21, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment