Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # get parameters for hostname and document root
- echo -e "Host name (e.g. dev.domain.com):"
- read hostname
- echo -e "Document root (directory):"
- read docroot
- # add entry to hosts file
- echo "127.0.0.1 $hostname" >> /etc/hosts
- # add entry to vhosts file
- echo "
- <VirtualHost *:80>
- ServerName $hostname
- DocumentRoot $docroot
- SetEnv APP_ENVIRONMENT development
- <Directory $docroot >
- Options -Indexes FollowSymLinks
- AllowOverride AuthConfig FileInfo
- Order allow,deny
- Allow from all
- </Directory>
- </VirtualHost>" >> /etc/apache2/extra/httpd-vhosts.conf
- # set correct permissions
- chmod 755 "$docroot"
- # restart apache
- apachectl restart
- echo "VirtualHost added for $hostname."
Add Comment
Please, Sign In to add comment