Last active
February 19, 2023 16:22
-
-
Save notcod/f4ecb2c70f4d4f1b5420d247fd03b98e to your computer and use it in GitHub Desktop.
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 | |
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