GEOG5870/1M: Web-based GIS A course on web-based mapping

General: Setting up your own server space

Setting up your own server involves several steps:

  1. Setting up a machine.
  2. Getting an IP address.
  3. Getting an Domain Name.
  4. Setting up your firewall.
  5. Setting up Apache.

Setting up a machine.

Your simplest option by far is to get a PC and install OSGeo-Live, which comes with all the servers set up and configured for serving geographical data. Another, cheaper, option is to set up a Raspberry Pi as a webserver, but you'd have to then install the various bits of software yourself (it's not that hard though).

Getting an IP address

While Universities etc. got in early and allocated themselves fixed IP addresses, most users on the net don't have a fixed IP address. Most Internet Service Providers (ISPs) farm out an IP address to your home from their bank of addresses: a so-called dynamic IP address. However, most servers need a fixed IP address so people can find them time after time through Domain Name System lookups. To fix this problem, you have two choices: you can either get your ISP to give you a static address, or you can buy a forwarding service. Some ISPs, especially those offering TV services etc. may already have given you a static IP address: Virgin, for example, seem to dynamically allocate IPs, but on the basis of hardware (MAC) addresses, so by most accounts they don't change unless you change router. Equally, some ISPs will sell you a static IP address (PlusNet, for example). Either way, you should check your terms and conditions, as some ISPs limit what static IP Addresses can be used for (for instance, to prevent them being used for email spam). If your ISP doesn't offer a static address, then you can set up Dynamic DNS on your router. DDNS works by your router sending its dyanmically allocated IP Address regularly to a third party who do have a static IP address and who allocate the address to you. They then forward any requests coming to the IP address to you at your latest IP Address. Popular services like this include NoIP and ZoneEdit. Most DDNS companies will also offer Domain Name buying options.

Once you have a static IP address or DDNS, it is important to realise that this will be for your router (and you should *always* connect through a router, as they have extra firewall options). A specific machine within your internal network may still be allocated a subnet address dynamically. This will usually be something line 192.168.1.X where X is some number allocated based on which machines booted first. If this is the case (and you can set up routers to issue individual static subnet addresses), you'll need to tell your Linux box to grab a fixed address. You can find instructions for doing this on WikiHow or NixCraft (also, for Windows on Linksys and Microsoft). You'll also need to check how to configure your router so it doesn't allocate it when the machine is off. You may also find you need to adjust your hosts file, but this is less likely.

Getting a Domain Name.

Once you have a solid IP Address, you can then point a domain name at it. First you need to buy a Domain Name from a Domain Name Registrar (list). You'll then get the option of setting up various Domain Name System (DNS) records, the most important of which is the A record, which points your domain name at your IP Address. Once this is set up, this combination with be propagated around the DNS lookup tables worldwide (takes up to 24 hours), and then anyone using a URL containing your domain name will get routed to your IP Address.

Setting up your firewall.

Having got an IP address for your router, and having directed traffic to it, you'll now need to allow appropriate traffic into your router and get it to forward it to the subnet address of your server. This is done through Port Forwarding which you set up on your router. As this varies by router, you'll need to search for how it is done with your particular router. However, note that this is the bit that opens your network to the world, so be very careful what you do, and only trust legitimate sources of information. You'll need to forward traffic to Port 80 of your router to your subnet addressed server, but you probably want to leave it at that for the moment. If, later, you want to do remote administration, you might consider opening other ports, but when starting I'd just do this via your internal network which should allow through SSH.

Your Linux box, if that's what you're using, will also have a firewall on it – probably the one built into the Linux kernal. Chances are that the management software for this will be either Iptables (intro) or Nftables. Both are relatively tricky to manage, so many people install Shorewall, which makes configuring them simpler. For installation and setup details, see the Shorewall website. Again, you'll need to allow Port 80 incoming communications.

Setting up Apache.

Finally, we need to set up our webserver for our domain name. You can find details of setting this up for Apache in the documentation (indeed, you should read all the documentation, not least because you'll need to reboot/start the server). The usual thing is to set up a Virtual Host which allows you to attach several domain names to one IP Address. You can see if a server is running locally by typing http://localhost:80/ as a URL. If you can see it working here, but not on the web more generally, it is a networking/virtual server config problem, not a problem with Apache running.

At the end of that, you should be able to type in your domain name in a web browser and see your server working!


[Setup]