How to Install Webserver in Ubuntu AWS EC2


Amazon Web Services (AWS) is a cloud service provided by Amazon, a giant internet company. While, Virtual Private Server (VPS) is a virtual machine or virtual computer that runs its own copy of an operating system. VPS customers will have a superuser-level access to the operating system instance, so they can install any kind of software that compatible with the operating system, kind of like administrator in non-virtual computer.

This tutorial can also be used for setting up webserver in any Ubuntu servers other than Amazon Web Services, even local server. This tutorial uses Ubuntu Server 14.0. So, let’s get started.

SSH Access

Access the server via SSH. SSH or Secure Shell is a cryptographic network protocol for operating network services securely over an unsecured network. You can use Putty if you are using Windows, and terminal if you are using Mac or Linux. First of all, you need to execute this script:

chromd 400 your-keypair.pem

Then, access EC2 server

ssh –t “your-leypair.pem” username@1p

After that you will be redirected the terminal of Ubuntu server.


Install Apache

In this tutorial, the web server that is used is an Apache. If you want to use Nginx, you are always welcomed.

sudo apt-get install apache2 apache2-doc apache2-utils

Wait until it is finished. Then try to access EC2 IP from your browser. It it success, this page is not from our computers or devices.


If you want to install Mods and Scripts, you can always do it, but in some cases, you do not really need it because of your work so I will add it just if I will need it.

Install PHP

Now, in web server you can always ask the server to download PHP.

sudo apt-get install php5 libapache2-mod-php5

If it works, I will be doing a test like this.

cd /var/www/html

This is the public folder (default).

pico info.php

In this tutorial, the text editor that is used is pico. You can always use other text editors.




I will save it as info.php.

Next, you can access the information page using the browser. It will display the configuration information.


Install MySQL Server

Next, you are going to install MySQL Server.

sudo apt-get install mysql-server

The result of that code is like this picture below.


You will need to input password root to access mysql server, then the confirmation window will show up.

Install PhpMyadmin

After that, you are going to install PhpMyadmin.

sudo apt-get install phpmyadmin

This kind of message will show up:


Choose apache2 by holding space button, then tap tab button twice toward OK. After that, click Enter. This message will show up:


Choose Yes. Then, run this code.

sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d

After that, restart Apache.

sudo /etc/init.d/apache2 restart

Now, you can access the PhpMyadmin page. Insert username and password that you set before.


After all the configurations finished, you can finally use Ubuntu Server to develop web or other applications. You can always make further configuration thru Apache. This tutorial shows a simple way to make a webserver and doing a database installation. You can explore more about AWS’s existing database features, such as RDS.

Leave a Reply

Your email address will not be published. Required fields are marked *