Set up Apache 2.2 for Ubuntu 12.04 for easy development by Vagrant user
This file contains 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
#!/bin/bash | |
# Add phpinfo to web dir as a convenience | |
echo "<?php phpinfo();" > /var/www/phpinfo.php | |
# We will have Apache run as Vagrant user because this will help prevent permissions issues on a dev setup | |
sed -i "s/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=vagrant/" /etc/apache2/envvars | |
chown -R vagrant /var/www/ | |
usermod -a -G www-data vagrant | |
# Enable some important Apache modules | |
a2enmod headers expires deflate rewrite | |
# Enable DEFLATE on application/json - this helps speed up downloads of Sugar data | |
cat >> /etc/apache2/mods-enabled/deflate.conf <<DELIM | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE application/json | |
</IfModule> | |
DELIM | |
# Update Apache config on web server to AllowOverride | |
sed -i "s/AllowOverride None/AllowOverride All/" /etc/apache2/sites-enabled/000-default | |
# Set up port 8080 virtualhost config to allow interactive installs of Sugar from Host system when using Vagrant | |
# Also make sure sugar directory has AllowOverride enabled | |
cat >> /etc/apache2/sites-available/sugar <<DELIM | |
Listen 8080 | |
<VirtualHost *:8080> | |
ServerName localhost | |
DocumentRoot /var/www | |
</VirtualHost> | |
<Directory "/var/www/sugar"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> | |
DELIM | |
a2ensite sugar | |
# Restart apache22 when done | |
apachectl restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment