Skip to content

Instantly share code, notes, and snippets.

Created July 28, 2014 17:02
Show Gist options
  • Save anonymous/d72dcb22ebe3637eba48 to your computer and use it in GitHub Desktop.
Save anonymous/d72dcb22ebe3637eba48 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ ! -f /etc/apache2/apache2.conf ];
then
echo "updating packages"
apt-get update
echo "installing apache"
apt-get install -y --force-yes apache2
echo "installing php"
apt-get install -y --force-yes php5 php5-mysql libapache2-mod-php5 php5-sqlite
echo "installing php modules"
apt-get install -y --force-yes php5-sqlite
apt-get install -y --force-yes php-apc
apt-get install -y --force-yes php5-intl
apt-get install -y --force-yes php5-xdebug
apt-get install -y --force-yes php5-curl
cat << EOF | sudo tee -a /etc/php5/cli/php.ini
date.timezone = Europe/Paris
EOF
cat << EOF | sudo tee -a /etc/php5/apache2/conf.d/php.ini
date.timezone = Europe/Paris
EOF
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
xdebug.max_nesting_level=250
EOF
echo "installing mysql"
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
apt-get install -y --force-yes mysql-server
echo "configure apache vhost"
a2dissite 000-default
rm /etc/apache2/sites-available/000-default.conf
cat << EOF | sudo tee -a /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost.dev
DocumentRoot /var/www/web
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
a2ensite 000-default
echo "configure apache modules"
a2enmod rewrite
echo "restart apache server"
service apache2 restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment