web stats

How to Turn your Ubuntu Machine Into a Webserver

Turning your existing Ubuntu installation really couldn’t be simpler, and if you’re looking to get into web design or development then this might help.

1. Installing Apache

Apache is webserver software which will allow you to host all your files on your computer, letting you or anyone else view them in a web browser. To install Apache, run this command…

sudo apt-get install apache2

2. Installing php

Assuming you will be wanting to work with php when designing your site, you’re also going to have to install php. This step isn’t necessary if you’re not looking to use php, but I’d recommend doing it anyway, just in case you might need it in the future.

sudo apt-get install php5

3. Accessing your www directory

Your www directory is where you will place all of your webpages and directories. This folder can be accessed by browsing to the following location…

/var/www

4. Opening up port 80 (HTTP) to allow others to view your site

If you would like other people to view your site, you will have to allow incoming requests on your HTTP port. Go into your router’s configuration pages, and add an exception to the firewall. The way you do this is different for most routers, so read the manual before doing it.

5. Add your webpages, and view them in your browser

All you need to do now is add pages to your www file. Create a file using a text editor of some kind. My favorite on Linux is Scite, which is very similar to Windows’ Notepad++. To install Scite, run the usual command…

sudo apt-get install scite

When you have your index page, browse to your localhost (try this if that doesn’t work) to view your website!

If you want to show a friend, head over to WhatsmyIP, and send him/her your IP address. He can then put this in his browser, and view your site.

Enjoy!

Discuss

Leave a Reply