Skip to content

Instantly share code, notes, and snippets.

Created December 22, 2015 18:42
What would you like to do?
Set up Apache 2.2 for Ubuntu 12.04 for easy development by Vagrant user
# 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
# 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
<Directory "/var/www/sugar">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
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