IT in Education

Building a personal web server

awsUsually I recommend the use of professional web hosting services (eg., because they are very cost effective, and have lots of in-house expertise.  However your data protection policy, might require closer ownership of your data.  This article describes how to build an Ubuntu LTS Server, using Amazon Web Services, with a Micro instance (lowest cost, approx 2p per hour when I wrote this article) to create your own personal web server.

Visit the Amazon Web Service site to review AWS and to learn more.

If you don't already have hosting, Siteground offer excellent value and service.

Getting Started

Be warned that once you start a server up, you will start to be charged in accordance with Amazon's pricing structure.  Once you've finished with a server instance make sure you terminate the instance to stop being charged.  In this example we will start an Ubuntu Server 12.04.2 LTS.

  1. Create an Ubuntu Server 12.04 LTS with EC2.
  2. Create an Elastic IP address for the server.
  3. Connect to your server using SSH.

Software Installation

For this server to act as a web server, it'll need the LAMP stack software installed.  You could install the software separately...

  1. Install Apache.
  2. Install PHP.
  3. Install MySQL.

Or you could install it in one go...

$ sudo tasksel --selection server

Choose LAMP server.

Domain Name Resolution

Assuming you own a domain, you might want to point some domain names at your newly created web server.  Remember that if you change your Elastic IP Address for your AWS server, you'll also need to update your Domain Name resolution.  IP address changes for Domain Names can take from a few hours to 72 hours to fully update on the internet.

Apache Configuration

By default, Apache will serve the web page in /var/www.  We will now configure Apache to change the document root, and create a new virtual host for our domain name.

  1. Change the default Document Root.
  2. Create a Virtual Host.

cURL Configuration

If your web application requires support for cURL, you will need to install the following...

sudo apt-get install php5-curl

sudo service apache2 restart

Web Server Tools

You may decide to install some further web server tools, like phpMyAdmin and vsftpd.  If you use vsftpd, you might also need FileZilla with SFTP.  You may also need to install sendmail, if your web applications require the sending of emails.

sudo apt-get install sendmail

Thanks for visiting,