Windows Web Server

Setting up a Windows Apache Web Server

The Server in the Cellar - Page 1

The Server in the Cellar

Setting up a home web server :-

When Lycos UK decided to put an ad-frame onto their members pages in June 2003 I started to look around for some other hosts. There are plenty available but they've all got their limitations, pop-ups, pop-unders, slowness, no FTP client support and so on. In the end I decided that as plenty of other people host their web sites from home then so can I.

Computer :-

One of the first things to know is that web servers need not be big, heavy-duty machines. A little while before, our local college, Ivy Tech, had been selling old computers for $25 and I'd bought one of them. They were old MMX 200MHz machines with very little memory and small hard drives. I had some old Macs lying around, a Power Mac 6100, a Performa 410 and a G4 that had a fried processor. By trial and error I added the memory and SCSI hard drives from these to the MMX machine.

Computer / Disk Management :-

I then loaded Windows 2000 Pro onto the old hard drive, which was barely big enough to hold it. In fact, I first tried using Windows 2000 Server but the drive was far too small. But the machine couldn't see the new SCSI drives. To get around that I used the Computer Management Console in Windows 2000. You can access this by right-clicking on My Computer and choosing Manage then Disk Management. Or you can get to it from Start > Settings > Control Panel > Administrative Tools > Computer Management. This should get you to a screen similar to the one below.

Windows 2000 Disk Management Console

So long as the BIOS recognizes the disk then Disk Management should as well. By clicking in the lower right pane you'll get another menu asking what sort of disk you've got, a Basic Volume is fine for this.

A couple of days later I saw a 30Gb Maxtor drive on sale for $30 from Circuit City, so I removed both the original and the SCSI drives and added that. The only other thing was that the network card in the MMX machine didn't work so I had to buy a new one of those as well, but they are cheap, only $15.

The computer was changed in November 2004 to an AMD 1.4Ghz Athlon with 256Mb RAM and 40Gb hard drive.

Server Software :-

The next thing to do was to find some server software. I had originally planned on using Windows 2000 Server but after reading about some of the security issues with IIS (Internet Information Services) and PWS (Personal Web Server) decided to find something else. In the end I decided to go with Apache HTTP Server.

I downloaded and installed version 2 of the software and installed that.

Typing http://localhost into the browser you can see the apache install screen.

Apache install screen

The only other software I put on the machine was Zone Alarm firewall, AVG anti-virus and Ad-Aware anti-spyware.

Apache Configuration :-

Apache must be stopped and restarted to make the changes in the configuration file work.

The Apache configuration file, httpd.conf, I originally left pretty much alone, except for the following lines ...

ServerAdmin changed to ServerAdmin brisray@yahoo.co.uk - this is my email address, so server problems can be emailed to me

ServerName :80 changed to ServerName www.brisray.com:80

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs" changed to DocumentRoot "D:/brisrayweb" - this is where my website is stored on the server

<Directory "C:/Program Files/Apache Group/Apache2/htdocs"> changed to <Directory "D:/brisrayweb">

UserDir "My Documents/My Website" changed to UserDir "D:/"brisrayweb"

DirectoryIndex index.html index.html.var changed to DirectoryIndex index.html index.htm

ErrorLog logs/error.log changed to ErrorLog "|C:/cronolog/cronolog.exe D:/weblog/%Y%merror.log" - this is so that that cronolog can rotate (split) the error and log files. I've haven't had too much luck with this program and need to investigate what is going on. One thing I did learn was that because Apache, and lots of the add-ons for it, were developed for Unix or Linux computers even the Windows versions of these programs do not like files or directories with spaces in their names. For this reason, as with web sites themselves, it's best to use all lowercase and no special characters.

CustomLog logs/access.log common - this was commented (#'d) out'

#CustomLog logs/access.log combined was changed to CustomLog logs/access.log combined - basically the comment (#) was removed.

See the section on Logs on Page 2 for why the following three lines were changed.

#EnableSendfile Off was changed to EnableSendfile Off - basically the comment (#) was removed.

Win32DisableAcceptEx - was added

#EnableMMAP Off was changed to EnableMMAP Off - basically the comment (#) was removed.

Internet Connection and Router Configuration :-

We use Verizon DSL here at home, which uses a Fujitsu Speedport Modem and a Netgear EN104 4 port 10Mbps Ethernet Hub. In December 2004, the Netgear Hub was replaced by a Belkin High-speed Mode Wireless G Router.

The router was easy to set up and all the computers attached to it, or using the wireless capability, connected first time. One weird problem is that when I go to brisray.com from a computer attached to the router I get the Belkin router configuration screen. For this reason, be sure to set a password. This can be done in the System Settings section. I later figured out how to get around this by using the Windows hosts file - see Page 2

Router configuration screen

To actually view the website from the computers using the router I have to go to the IP address of the web server. The router acts as a DHCP server so the IP of the computers connected to it is determined by the router. Because the connection with my ISP, Verizon, keeps getting dropped (it can go months with no problems then suddenly I repeatedly lose the connection several times a day for a week or so) I decided to give the web server a static IP. To do this I opened the Start > Network Connections then right clicked on "Local Area Connection" and then clicked on Properties. Then I scrolled down to "Internet Protocol (TCP/IP)" and clicked on Properties. when the next screen appeared I clicked on "Use the following IP address"

Setting a static IP address using TCP/IP properties

Setting a static IP address using TCP/IP properties

The IP address is the static IP address for the computer I want to use
Subnet mask is set to 255.255.255.0
Default gateway is the LAN side IP address of the router
The DNS server address has to be manually set and can be obtained from your ISP. Verizon uses 4.2.2.1 - 4.2.2.6

When you set a static IP, you must use an address outside the DHCP range used by the router. This is to stop conflicts when the router assigns IP address. With the Belkin router this is configured in the LAN settings.

Setting the DHCP range

Setting the DHCP range

To make sure that particular computer (the web server) can be seen by the outside world the router has to be set up to allow HTTP and FTP calls to that computer. This is done by using the Virtual Servers section under the Firewall heading of the router configuration.

Allowing FTP and HTTP access

The IP address for the website is now the routers WAN IP address, this means that it is this address that has to be entered into the DNS servers. At the time of writing this was 4.5.243.82. I use a dynamic DNS server provided by EveryDNS. Using this service is easy. As the domain is registered with GoDaddy the first thing I did after registering with EveryDNS was to go to the GoDaddy domain management site and change the name servers from GoDaddy's to EveryDNS's. Next I downloaded and installed Matt Whitlock's dynamic DNS helper - this is available from EveryDNS. What this program does is contact the nameservers and informs them of the server's IP address. The program is very simplistic and I found the best way to use it is to write a batch file and run it daily using Windows Scheduler. The DNS helper program, although it is based on the web server computer, when it contacts EveryDNS it gives the router address. No extra setup is required for this, it does it automatically. This means that anyone using http://brisray.com is sent to the router WAN address at 4.5.243.82. The router then sends the call to the web server.

This page created 12th August 2003, last modified 25th April 2008


GoStats stats counter