Tuesday, 8 March 2011

Setting up a Web Server - Part One: Making the right choice

So, you want to set up your own Web Server? In this post I'm going to try and help you through the minefield of acronyms to help you decide what type of Web Server you want.

The first thing you have to decide is what platform you're going to run. If you just want to use your desktop computer to try out your pages on before you upload to your website, then you'll want to use one of the many Windows options. If you want to run a stand-alone server, possibly connecting it to the outside world, then your best bet is to use a Linux-based system as all your software will be open source - crucially this means free! Because the software for a Linux-based system is all free and Open Source, these are the most commonly used systems for Web Servers, but just because your site is on a Linux machine doesn't mean you can't run it on your Windows desktop.

Step 1: Decide what sort of web site do you want to build

Web sites come in a number of programming flavours, the most popular are:
  • HTML - static pages, built using simple HTML (or XHTML) code;
  • PHP - pages built with simple HTML, and incorporating PHP scripting code to add greater functionality to the site (including connecting to databases);
  • ASP or ASP.NET - pages built with simple HTML, and incorporating Microsoft's scripting to add greater functionality to the site (including connecting to databases). Most developers use VBScript for Classic ASP, however other scripting languages can be used. ASP.NET supports any .NET language (most commonly VB.NET or C#);
If you only want a simple, static, web site then you can stick to HTML. However, if you think you'll ever want to do something a bit more fancy, you're going to need a scripting language. Traditionally Windows Web Servers are used for ASP and ASP.NET sites, while PHP is less frequently used on Windows - but it's not unheard of, and this option is well supported. Linux servers are used for PHP sites.

Your next decision is whether or not you need a database - or might like to add one at a later date. Again, there are a number of flavours available:
  • MS Access - not really ideal, unless you are sure that the database isn't going to become particularly large. MS Access is only available on Windows servers;
  • MS SQL - used exculsively on Windows servers, this provides a more stable database environment for larger sites. MS SQL databases tend to be more expensive, and you will have to buy the server software to install on your own setup;
  • MySQL - available on both Windows and Linux (so you can have Linux hosting but run your own test site on your Windows desktop). MySQL is currently free Open Source, however the product was bought in the tail end of 2010 by Sun and the development community fears that they may start to charge for the server software in the future;
Having decided on what type of site, and what database, you want to work with you can now make your choice of server type.


Step 2: Decide what type of server you're going to use

As already mentioned you can use Windows or Linux for your server. If you've only got a desktop PC or laptop and just want a test bed for a single site, or your site is hosted on a Windows server, then your options are:
  • WIMP - Windows, IIS (Internet Information Server), MySQL/MS Access/MS SQL, PHP;
  • WIMA - Windows, IIS (Internet Information Server), MySQL/MS Access/ MS SQL, ASP (or ASP.NET);
  • WAMP - Windows, Apache Web Server, MySQL, PHP;
At this point it's worth noting that officially you can only install IIS on Windows XP Pro, Windows 2003 Server, Windows 7 Ultimate and Windows 7 Professional. However, if you Google for Installing IIS on Windows XP Home you'll see that there are ways to get around this limitation. However, this may persuade you that Apache is the way to go.

If you've got an unused PC that you can safely reformat, and your site is hosted on Linux, then your need to set up a LAMP server (Linux, Apache Web Server, MySQL, PHP).

If your site is hosted on Linux, but you're setting up a server on your Windows desktop don't panic. You can use either WIMP or WAMP - the most important thing is make sure that you use the same database server technology as your hosts and the same programming language. So if you're on Linux with your hosts, you need MySQL on your own server.

Step 3: Install the software

The next step is to install the software. As installing additional software on an existing Windows system is a simple case of following the wizards, I'm now going to concentrate on LAMP servers. For a dedictated Windows user, working with Linux can be rather daunting. Watch out for my next post detailing how to install and set up a  LAMP server.