Advertisement
Guest User

addvhost

a guest
Oct 23rd, 2014
210
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None
  1. #!/bin/bash
  2.  
  3. echo "Informe o nome do server (Ex.: project.dev) :"
  4. read server
  5.  
  6. echo "Informe o caminho do site (Ex.: /var/www/project-directory) :"
  7. read path
  8.  
  9. echo "Criando configuração de VHost para o server..."
  10.  
  11. echo "
  12. <VirtualHost *:80>
  13.    ServerAdmin webmaster@localhost
  14.    ServerName $server
  15.    ServerAlias www.$server
  16.  
  17.    DocumentRoot "$path"
  18.  
  19.    <Directory "$path">
  20.        Options Indexes FollowSymLinks MultiViews
  21.        AllowOverride All
  22.        Order allow,deny
  23.        Allow from all
  24.    </Directory>
  25. </VirtualHost>
  26. " > /etc/apache2/sites-available/$server.conf
  27.  
  28. echo "Ativando VHOST $server"
  29. ln -s /etc/apache2/sites-available/$server.conf /etc/apache2/sites-enabled/$server.conf
  30.  
  31. echo "Atualizando arquivo hosts"
  32. echo "127.0.1.1 $server www.$server" >> /etc/hosts
  33.  
  34. echo "Reiniciando apache";
  35. /etc/init.d/apache2 restart
  36.  
  37. echo "VHOST criado sucesso.";
Advertisement
RAW Paste Data Copied
Advertisement