Last active
May 14, 2018 21:19
-
-
Save ildarkhasanshin/c0e2703b924a6d90287c691affa6298c to your computer and use it in GitHub Desktop.
lamp :: быстрое добавление домена
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 | |
echo "enter domain (without http/https/www/..; for example my-domain.com): " | |
read domain | |
if [[ $domain != "" ]] | |
then | |
domainwww="www.$domain" | |
echo $domain | |
echo $domainwww | |
sudo mkdir "/var/www/html/$domain" | |
sudo chown -R $USER "/var/www/html/$domain" | |
sudo cp "/etc/apache2/sites-available/000-default.conf" "/etc/apache2/sites-available/$domain.conf" | |
sudo sed -i "s/ServerName www.example.com/ServerName $domain\n ServerAlias $domainwww/g" "/etc/apache2/sites-available/$domain.conf" |