Install Webserver

DB_ROOT_PASS=terceS
 
debconf-set-selections <<\EOF
mysql-server-5.5 mysql-server/root_password_again string terceS
mysql-server-5.5 mysql-server/root_password string terceS
EOF
 
# install some basic tools
apt-get -y install bzip2 wget vim
 
# install apache
apt-get -y install apache2
 
# install php
apt-get -y install php5
# OPTIONAL
apt-get -y install php5-mcrypt php5-gd php5-curl php5-cli 
 
# install mysql
apt-get -y install mysql-server php5-mysql libapache2-mod-auth-mysql 
 
# configure apache modules
a2enmod auth_mysql
 
# install ssl
http://www.panticz.de/apache2_openssl_certificate
 
# enable url rewrite
a2enmod rewrite
sed -i 's|AllowOverride None|AllowOverride All|g' /etc/apache2/sites-enabled/*default
# old # sed -i '11s|AllowOverride None|AllowOverride All|g' /etc/apache2/sites-available/default
 
# emable ssl
a2enmod ssl
a2ensite default-ssl
sed -i '12s|AllowOverride None|AllowOverride all|g' /etc/apache2/sites-enabled/default-ssl
 
# update memory limit for php
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.org
sed -i 's|memory_limit = 16M|memory_limit = 256M|g' /etc/php5/apache2/php.ini
cp /etc/php5/cli/php.ini /etc/php5/cli/php.ini.org
sed -i 's|memory_limit = 32M|memory_limit = 256M|g' /etc/php5/cli/php.ini 
 
# configure timezone
# broken? # sed -i 's|;date.timezone =|date.timezone = Europe/Berlin|g' /etc/php5/apache2/php.ini
 
# set hostname
cp /etc/hosts /etc/hosts.org
echo "your_host_name" > /etc/hostname
echo "192.168.1.88   $(hostname).example.com   $(hostname)" >> /etc/hosts
 
# restart apache
/etc/init.d/apache2 restart
 
# OPTIONAL
# parse .html files with php (.htaccess)
AddHandler application/x-httpd-php5 .html .htm
 
# ToDo
# enable ssl: a2enmod ssl
# See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.