Advertisement
worlok110

apache new vhost

Jul 30th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.71 KB | None | 0 0
  1. #!/bin/bash
  2. # script screazione virtual host nuovo.sh nomesito
  3. # nuovo.sh nomesito pub
  4. sudo -v
  5.  
  6. if [ "$2" == "pub" ]
  7. then
  8.     echo "Creazione virtualhost: $1 con webroot in $HOME/www/$1/public/"      #con cartella che punta in www/pub
  9.     sudo cp /etc/apache2/sites-available/template-pub /etc/apache2/sites-available/$1
  10. else
  11.     echo "Creazione virtual host: $1 con webroot in in $HOME/www/$1/"           #con cartella in home/www/
  12.     sudo cp /etc/apache2/sites-available/template /etc/apache2/sites-available/$1
  13. fi
  14.  
  15. sudo sed -i 's/template/'$1'/g' /etc/apache2/sites-available/$1
  16. sudo sed -i '1s/^/127.0.0.1       '$1'.local\n/' /etc/hosts
  17.  
  18. sudo a2ensite $1
  19. sudo service apache2 reload
  20.  
  21. echo "Host $1 Creato!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement