Web Server
Last updated at 2005/05/22 21:01:56 PDT by Temporal

Once Evlan is running, there are two main ways to set up an Evlan-based web server. The first (and original) method involves manually constructing all of the objects needed and hooking them up in order to "assemble" your server. This method gives you the most control over the way your server operates, giving you unparalleled flexibility. However, this first method is also rather complicated and unnecessary for most users.

The alternative is to use the ServerManager module which is included with Evlan. This module wraps the steps needed to build the most common configurations for both static-file servers and Io Community Manager-based servers, while still allowing a good deal of flexibility. The following instructions will show you how to do this.

First, log in to your Evlan VM using the Evlan client. The commands shown in boxes below will need to be copied and pasted into the client and executed. Start by importing the module:

ServerManager = import "/fateofio.org/manager/ServerManager"

(Note to OSX users: Due to some problems with OSX's I/O facilities and the way Evlan uses them, the above line may cause an error claiming that the resource is "temporarily unavailable". Simply repeat the line (press ctrl+up to recall the line from the command history) a few times and eventually it should work.

Create the server manager itself:

server := ServerManager.make(system, "login.example.com",
          false, "My web server!", "admin@example.com")

Replace "login.example.com" with the host name which will be used to handle login requests. This host name must resolve to your server. If you intend to use a port other than the default (80), include it (e.g. "login.example.com:8080"). This host name must be different from any host name used to access content on your server. If your server has only one host name and you can't give it another one, you can use the IP address or use a different port number.

If you intend to set up SSL support for your server to encrypt the login process, set the third parameter to "true" rather than "false". Your SSL certificate should be for the host you specified in the second parameter. Evlan does not support SSL internally; you must use a program like Stunnel to handle it. Read the SSL setup instructions for more info.

The last two parameters are the title of your server and your e-mail address, respectively. These will be included in e-mails sent to users who request new passwords.

The next step is to set what port to listen to:

/do server.listen("80", false)

This listens on port 80. You can use any port number you want, and can listen on multiple ports by issuing the command multiple times.

Now you can create your host. If you want a traditional server which serves static files, do:

host := server.makeHost("www.example.com")

Replace "www.example.com" with your host name. Again, if you are running on a non-default port, include the port number. Now, you can upload files to your site by pointing your web browser at http://www.example.com/admin/ (except, of course, replacing "www.example.com" with your hostname), then logging in with username "Administrator" and your Evlan password.

For instructions on creating an Io Community Manager-based site, see the IoCM instructions.

To make your site the default site for your server (so that any host name which resolves to your server but is not otherwise mapped results in this page), do:

/do server.setDefaultHost(host)

The ServerManager module can do a lot of other things, like delegating administrative privileges, creating hosts in sub-directories, and creating a page where you can view server statistics. All of this functionality is documented such that you can get more information by using the "/list" and "/help" interpreter directives. Please see the instructions on how to do this in general.

evlan.org © Copyright 2003-2005 Kenton Varda
Powered by Io Community Manager, Evlan, and FreeBSD