Guest User

Untitled

a guest
Oct 19th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # get parameters for hostname and document root
  4. echo -e "Host name (e.g. dev.domain.com):"
  5. read hostname
  6.  
  7. echo -e "Document root (directory):"
  8. read docroot
  9.  
  10. # add entry to hosts file
  11. echo "127.0.0.1 $hostname" >> /etc/hosts
  12.  
  13. # add entry to vhosts file
  14. echo "
  15. <VirtualHost *:80>
  16. ServerName $hostname
  17. DocumentRoot $docroot
  18. SetEnv APP_ENVIRONMENT development
  19. <Directory $docroot >
  20. Options -Indexes FollowSymLinks
  21. AllowOverride AuthConfig FileInfo
  22. Order allow,deny
  23. Allow from all
  24. </Directory>
  25. </VirtualHost>" >> /etc/apache2/extra/httpd-vhosts.conf
  26.  
  27. # set correct permissions
  28. chmod 755 "$docroot"
  29.  
  30. # restart apache
  31. apachectl restart
  32.  
  33. echo "VirtualHost added for $hostname."
Add Comment
Please, Sign In to add comment