Created
August 23, 2013 00:34
-
-
Save chrisenytc/6314356 to your computer and use it in GitHub Desktop.
Script to Create Apache vHosts
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 "Informe o nome do server (Ex.: project.dev) :" | |
read server | |
echo "Informe o caminho do site (Ex.: /var/www/project-directory) :" | |
read path | |
echo "Criando configuração de VHost para o server" | |
echo " | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName $server | |
ServerAlias www.$server | |
DocumentRoot "$path" | |
<Directory "$path"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> | |
</VirtualHost> | |
" > /etc/apache2/sites-available/$server | |
echo "Ativando VHOST $server" | |
ln -s /etc/apache2/sites-available/$server /etc/apache2/sites-enabled/$server | |
echo "Atualizando arquivo hosts" | |
echo "127.0.1.1 $server www.$server" >> /etc/hosts | |
echo "Reiniciando apache"; | |
/etc/init.d/apache2 restart | |
echo "VHOST criado sucesso."; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment