Created
March 24, 2014 17:49
-
-
Save ianlintner-wf/9745407 to your computer and use it in GitHub Desktop.
Create a ideal vhost for drupal via shell script. Customize for your site / var web directory.
This file contains hidden or 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
| #!/usr/bin/env bash | |
| tmpfile=/tmp/vhostfile | |
| vhost=/etc/apache2/sites-available/$1 | |
| echo "creating $vhost for directory /var/sites/$2" | |
| echo "<VirtualHost *:80>" > $tmpfile | |
| echo " DocumentRoot /var/sites/$2" >> $tmpfile | |
| echo " ServerName $1" >> $tmpfile | |
| echo " RewriteEngine On" >> $tmpfile | |
| echo " RewriteOptions inherit" >> $tmpfile | |
| echo " CustomLog /var/log/apache2/$1.log combined" >> $tmpfile | |
| echo "</VirtualHost>" >> $tmpfile | |
| cp $tmpfile $vhost | |
| a2ensite $1 | |
| service apache2 reload | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment