Sunday 15 July 2018

How to install the Apache web server with PHP in EC2

How to install the Apache web server with PHP in EC2

Step 1: Login to SSH
Login to Ec2 instance using public DNS (like ec2-54-173-191-129.compute-1.amazonaws.com)
For example:
ssh -i "arunkg.pem" ec2-user@ec2-54-173-191-129.compute-1.amazonaws.com


In Window, you can use download putty and then login.
PuTTY does not support the private key format (.pem) generated by Amazon EC2. PuTTY has a tool named PuTTYgen, which can convert keys to the required PuTTY format (.ppk). You must convert your private key into this format (.ppk) before attempting to connect to your instance using PuTTY. (Note: You need to convert )


Step 2: Login as root usr
sudo su


Step 3: Update the server
yum update -y


Step 4: Install Apache, PHP and MySQL
yum install httpd php php-mysql stress -y


Step 5: Write something in index.php
cd /var/www/html //go to html folder
vi index.php //Write someting in index.php


Step 6: Start the service
service httpd start