Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
lamp :: быстрое добавление домена
echo "enter domain (without http/https/www/..; for example "
read domain
if [[ $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 $domain\n ServerAlias $domainwww/g" "/etc/apache2/sites-available/$domain.conf"
sudo sed -i "s/\/var\/www\/html/\/var\/www\/html\/$domain/g" "/etc/apache2/sites-available/$domain.conf"
sudo sh -c "echo >> /etc/hosts"
sudo sh -c "echo $domain >> /etc/hosts"
sudo sh -c "echo $domainwww >> /etc/hosts"
sudo a2ensite -q "$domain.conf"
sudo systemctl restart apache2
echo "ok" >> "/var/www/html/$domain/index.php"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.