How to setup Apache web server on Amazon AWS with PHP
I personally prefer hosting a web server on Amazon AWS due to the flexibility and control I get on these AMI.
Here are the simple steps to setup Apache web server on Amazon AWS with PHP (since I am using the RDS instance, I wont talk about installing MySQL)
Create an Ubuntu AMI instance on AWS
Login to the server using SSH
Change user to ROOT
sudo su
Update the server
apt-get update
apt-get upgrade
Setup hostname
vi /etc/hosts
127.0.0.1 websvr1.ezref.info
Save the file
:wq!
echo web.ezref.info > /etc/hostname
service hostname start
hostname
hostname -f
[hostname and hostname -f should output the same result]
Install Apache
apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libapache2-mod-php5
Install PHP
apt-get install php5 php5-common php5-gd php5-mysql php5-imap php5-cli php5-ldap php5-cgi php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick
Install Sendmail
PHP mail() funciton uses sendmail to send emails from the web site, although this can be modified, I prefer to keep it the same for simplicity.
apt-get install sendmail
If you wish to install wordpress, you may also need to enable the mod_rewrite module.
a2enmod rewrite