How to set up a basic Web Server on Ubuntu 12.04

This tutorial will show you how to set up a basic web server. For this tutorial I have used Ubuntu 12.04 LTS but the steps work the same on any Linux distribution.


Ok first thing to do is give your server a static ip address.  This tutorial will show you how.  Once done it is time to download the software you will need so open up a terminal and install the following packages:

apache2 php5-mysql libapache2-mod-php5 mysql-server

During the install process MySQL will ask you for a root password.  Make this something complex but do not forget it!!!

Once installed open up a web browser and type http://your-server-address (e.g http://192.168.1.3) and you will see the message IT WORKS! This means that you have a working web server.

Now it is time to add some content to your server.  All apache servers store their web data at /var/www but as default you can not write to this folder.  Open up a terminal and type:

sudo nautilus

Enter your password when prompted.  Navigate to /var and right click on www.  Then go to properties.  Add yourself as either the owner or group and give yourself “create and delete files folder access“.

Next thing to do is to download some ftp software.  Personally I recommend Filezilla. Open up a terminal and type:

sudo apt-get install filezilla

Once installed connect to your existing web server and transfer your files into /var/www.

Congratulations!! Your website is now hosted on your new server but it will not yet be visible from the internet.  Most networks sit behind a router which acts as a firewall, so to make your website visible you will need to forward http packets from your router to your server by opening up port 80 and redirecting it to your servers new ip address. Portforward.com is a good starting point to understand port forwarding.

You will also need to speak to your ISP about getting a static ip address for your router. Without this you will not be able to access your site everytime your ip address changes.

And that is it!! You now have a basic web server from which to host your own website.

About the Author

Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients in and around Stirling.

For a list of what I can offer you why not visit my website www.comtech247.net where you will find a list of my services, testimonials, blog and much more.

This entry was posted in Blog and tagged apache, firewall, how to, mysql, port forwarding, router, ubuntu 12.04, web server. Bookmark the permalink.

3 comments on “How to set up a basic Web Server on Ubuntu 12.04

  1. BobW on said:

    Most newer routers have the DDNS client built right in so all you need to do is have an account with DynDns and fill in the blanks.

  2. Chris on said:

    I have never used ddns as I always use a static ip address when setting up my web servers. I will however be taking a look!!

  3. This is a good tutorial but I have 1 suggestion. Consider including a section on ddns. You simply install a ddns client on your machine (ddclient is a good one) and link it to your ddns account. Your server then periodically forwards your external IP to your account. There are several good companies that allow you to do this for free, I personally use dyndns. This is great for the cost conscious people that do not want to pay for a static IP or a domain, e.g. educational purposes, personal websites, etc.

Leave a Reply

Your email address will not be published.

50,722 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>