Skip to content

Instantly share code, notes, and snippets.

@ferndot
Last active July 23, 2017 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferndot/601efae6f8984ea5eb2c08201512c6b6 to your computer and use it in GitHub Desktop.
Save ferndot/601efae6f8984ea5eb2c08201512c6b6 to your computer and use it in GitHub Desktop.
Creates a website on apache.
cd /var/www/
sudo mkdir -p /var/www/$1/public_html
sudo ./perms.sh $1
echo "Success!" >> /var/www/$1/public_html/index.html
vHostFile=/etc/apache2/sites-available/$1.conf
sudo echo "<VirtualHost *:80>" >> $vHostFile
sudo echo -e "\tServerName $1" >> $vHostFile
sudo echo -e "\tServerAlias www.$1" >> $vHostFile
sudo echo -e "\tServerAdmin josh@204.44.81.119" >> $vHostFile
sudo echo -e "\tDocumentRoot /var/www/$1/public_html" >> $vHostFile
sudo echo -e '\tErrorLog ${APACHE_LOG_DIR}/error.log' >> $vHostFile
sudo echo -e '\tCustomLog ${APACHE_LOG_DIR}/access.log combined' >> $vHostFile
sudo echo "</VirtualHost>" >> $vHostFile
sudo a2ensite $1.conf
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment