Created
March 4, 2014 05:48
-
-
Save faisalarbain/9340940 to your computer and use it in GitHub Desktop.
Snippet to setup apache and VHOST for Vagrant Provisioner
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
# Apache | |
# ------ | |
# Install | |
apt-get install -y apache2 | |
# Remove /var/www default | |
rm -rf /var/www | |
# Symlink /vagrant to /var/www | |
ln -fs /vagrant /var/www | |
# Add ServerName to httpd.conf | |
echo "ServerName localhost" > /etc/apache2/httpd.conf | |
# Setup hosts file | |
VHOST=$(cat <<EOF | |
<VirtualHost *:80> | |
DocumentRoot "/vagrant/public" | |
ServerName localhost | |
<Directory "/vagrant/public"> | |
AllowOverride All | |
</Directory> | |
</VirtualHost> | |
EOF | |
) | |
echo "${VHOST}" > /etc/apache2/sites-enabled/000-default | |
# Enable mod_rewrite | |
a2enmod rewrite | |
# Restart apache | |
service apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment