When you think of web servers, your mind instantly turns to Unix-like operating systems such as Linux or some form of BSD – the vast majority of websites on the Internet run on a Unix-like server, they’re renowned for being ridiculously stable and never having to be rebooted. Linux/BSD web servers are usually run in a completely bare bones, command-line only mode in order to keep resource requirements to a minimum and minimising the amount of stuff you’re running that could be vulnerable to attack.
What’s had me thinking however is, I find RISC OS to be just as stable and it is capable of operating with very little memory and little resources – it’ll do all of this while throwing a graphical interface your way at the same time.
Lately I’d been toying around with the idea of running a basic web server on my home network that provides an interface that links me into the various services I run around my house – my email server, media server, file server etc. Remembering the details to access these services’ various web interfaces is a pain as I have to remember the IP address of the system as well as the port number that web interface is running on.
So seeing as I had a Raspberry Pi running as a VNC server for remotely accessing my RISC OS box from work, I figured I’d take a look at running a web server on it so that I can just point my browser to that web server and click into my various services from there.
From digging around, I found three HTTP web server software offerings to chose from, there are no applications out there that support HTTPS as far as I can see.
While there are alternatives out there such as Netplex from Warm Silence Software and h11p, the most widely used server of choice on RISC OS seems to be WebJames, and from the short amount of time I spent setting it up, I can see why. For the most part, it just works straight out of the box, you just decompress it from the Zip file it’s packaged in then you execute it – just as easy as setting up Apache or something on a Unix server.
Originally developed by Hernik Bjerregaard Pedersen, Web James is a HTTP web server that is compatible with all modern 32-bit RISC OS 5 systems and supports the below features:
- Supports GET, POST, HEAD, PUT and DELETE requests
- Content negotiation
- Cache for recently requested files
- Configurable logging of all requests
- Password protection
- Customisable error reports
- Standard CGI interface
- Custom CGI interface which allows multi-tasking scripts
- Supports Server Side Includes (SSI)
- Built in handler for PHP
- Support for name-based virtual hosts
Setting up WebJames
The installation process is as easy as you think, download the Zip file and unarchive it using SparkPlug or a similar application, drag and drop the !WebJames application into whatever location on your storage drive you want to keep it.
You’ll most likely want to ensure that !WebJames automatically runs whenever the machine boots into RISC OS just in case of any unexpected reboots. Editing the ‘PreDesk’ configuration file located here will provide this functionality – !Boot.Choices.Boot.PreDesk.
When run, WebJames will tick away in the background and respond to any HTTP requests it receives over port 80.
The files displayed by your webpage will be stored in the ‘Site’ directory within the directory you’ve saved !WebJames in. This is where your HTML files and anything else you want accessible via your web server will live.
If you’d rather not write your website manually via a text editor, you could use something like HTML3 to design the website that will run on your WebJames server. Alternatively, if you’ve already got a pre-designed website or something similar ready to upload from another machine, you can use something like Samba so that files can be dropped onto the RISC OS system running WebJames.
Just by running the !WebJames program, your web server should be running. By default, the webpage displayed in the screenshot at the bottom of this article will be displayed unless you’ve modified it. To make sure your web server is running, visit http://127.0.0.1 in a web browser on the system you’re running WebJames on, this should bring up your website.
If you ever need to troubleshoot issues with people accessing your website, or if you want to keep tabs on what IP addresses are connecting to you – there’s a log text file inside !WebJames named ‘clf’.
Local network configuration
If you want to access your website from an external network (i.e. via the Internet) then you’ll need to enable the firewall your web server is passing through to allow connections on port 80 (the HTTP port). With most setups this can be achieved by adding a port forwarding rule in your router’s firewall to allow TCP connections over port 80.
Should you decide you don’t require access to your web server from an external network – for example, you only need to connect to it from devices in your home so that you can easily link through to other servers/services on your home network – then you don’t need to do anything, traffic should pass over port 80 without a problem unless you have device-specific firewalls blocking this port (you’ll probably know about it if this is the case).
Accessing your website
Once your web server is setup and running on RISC OS, you can remotely access it by pointing any web browser to the IP address designated to your RISC OS machine running WebJames, or alternatively if you’ve configured a domain name to point to your IP address, you can visit the domain name.
LAN Access – If you’re accessing it from a device connected to the same local network as your server, then you can specify the LAN IP address for your device (e.g. 192.168.0.2) – it’s worth setting up a static LAN IP address in your router’s DHCP settings to ensure this stays the same. If you will be accessing the server from your local network and from external connections, then following the steps in the ‘WAN Access’ section below will be your best bet.
WAN Access – If your website needs to be accessed from machines outside your home network, then web browsers will need to point to your WAN IP address, which will be assigned to your Broadband modem. You can find out your IP address by searching ‘My IP’ using most major search engines,(click here for a pre-configured search query) or or alternatively if you’ve configured a domain name to point to your IP address, you can visit the domain name.
There we have it! You’re running a web server on your RISC OS computer.
A joke in Punch, well over a century old now, showed a traveller asking for directions and getting the reply Well sir, if that is where you want to get to, I would not start from here if I were you. There have been a good many threads in RISC OS blogs and mailing lists, started by a request for advice on how to solve some programming problem, which can only justly be answered this way.
We have to recognize that learning a programming language is a big investment of time and mental energy; so many people, having learnt one, usually BBC BASIC, are unwilling to start again with something different.
Moreover, it is natural that people should take pride in their efforts, and feel a pang of nostalgia for their youthful days when all things to do with computing had a halo of mystery. The same remarks may apply, for some, to coding in ARM assembler.
The trouble with this is that no programming language can be the best tool for all jobs. Although this is rather obvious, many people of limited programming experience do not fully appreciate this point.
Perhaps somewhere at the back of their minds lurks a miscomprehension of the fact that any Turing-complete programming language can simulate any other. Language wars are pointless when this point is properly understood. That is not to say that we cannot compare languages according to specific criteria.
When Acorn started they had to make many compromises if their products were to be afforded by schools. Nevertheless, in Cambridge, Acorn computers were used for one or two quite exotic academic projects in the field of programming language design.
But they were hampered by the high cost of memory in those days, so only expensive workstations could run systems with automatic memory management. Under the circumstances, equipping RISC OS with BBC BASIC was the best that they could do.
By the time that the cost of memory chips had come down sufficiently, Acorn was no longer on the scene, and the initial educational impetus was lost. Because reinventing the wheel is a necessity for learning (otherwise the student is faced with magic rather than reason) BBC BASIC still has a good educational role to play. But it does not expose students to important ideas in programming that have arisen since BASIC was invented, and so may leave them with a distorted idea of what programming is about.
This was the point of Dijkstra’s famous dictum:
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
In a very loose sense Acorn’s educational impetus has been taken up by the Raspberry Pi, with Python as a modern actor in the role once played by BBC BASIC.
There have been ports of earlier versions of Python to RISC OS that provided access to SWIs. Let us hope that some dedicated enthusiasts (younger than me) will make Python as attractive an educational tool under RISC OS as it is under Raspbian. Python is gaining in popularity and it comes with batteries included, unlike Lua (which I prefer for its simplicity).
For problems involving:
- pattern-matching and capturing data from text
- number-crunching and cryptography
- symbolic computation and algebra
- anything involving strings of indefinite size
- grammars and parsers
- complex datatypes
and much else, you should probably not be using BBC BASIC. Of course, trying to use BASIC for such things may be instructive, but also a bruising waste of time. Better to widen the horizons.