$ sudo apt-get update
$ sudo apt-get install apache2
# activate mod_rewrite
$ sudo a2enmod rewrite
#restart
$ sudo service apache2 restart
$ sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
# it will ask for password
$ sudo mysql_install_db
$ sudo /usr/bin/mysql_secure_installation
$ sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
$ sudo vim /etc/apache2/mods-enabled/dir.conf
# add index.php in first
# DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
$ sudo service apache2 restart
$ sudo apt-get install php5-suhosin php5-common php5-curl php5-gd
# if has no symlink between /var/www and /srv/www
$ sudo ln -s /var/www/ /srv/www
$ chmod -R 755 /srv/www
$ cd /srv/www
$ sudo mkdir site.com.br
$ sudo chown -R www-data:www-data site.com.br
$ sudo chmod -R 775 site.com.br
$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/site.com.br
$ sudo vim /etc/apache2/sites-available/site.com.br
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName site.com.br
ServerAlias www.site.com.br
DocumentRoot /var/www/site.com.br
[...]
$ sudo a2ensite site.com.br
$ sudo service apache2 reload
$ sudo vim /etc/apache2/envvars
# umask 002 to create files with 0664 and folders with 0775
umask 002
$ mysql -u root - p
mysql> create database [database_name];
mysql> CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'localhost' WITH GRANT OPTION;
mysql> flush privileges;