Skip to content

Instantly share code, notes, and snippets.

@notcod
Last active February 19, 2023 16:22
Show Gist options
  • Save notcod/f4ecb2c70f4d4f1b5420d247fd03b98e to your computer and use it in GitHub Desktop.
Save notcod/f4ecb2c70f4d4f1b5420d247fd03b98e to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi
if [ -f "/etc/apache2/sites-available/$1.conf" ]
then
echo "File exist!"
else
cp /etc/apache2/sites-available/default.conf /etc/apache2/sites-available/$1.conf
cp /etc/apache2/ssl/default.pem /etc/apache2/ssl/$1.pem
cp /etc/apache2/ssl/default.key /etc/apache2/ssl/$1.key
sed -i "s/default/$1/g" /etc/apache2/sites-available/$1.conf
sed -i "s/example/i3site/g" /etc/apache2/sites-available/$1.conf
a2ensite $1.conf > /dev/null 2>&1
mkdir /var/www/$1
echo "welcome to $1" > /var/www/$1/index.php
service apache2 restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment