web server, for example, helps primarily to deliver web pages when requested from
clients by means of Hyper text Tr ansfer Protocol (HTTP). A web server also provides
web developers with the m eans to p ublish their contents.
Up to this moment, we have been doing just fine without a server because our job has
merely been displaying HTML docu ments inside a browser. Interpreting and render-
ing HTML con te nt is exclusively the browser’s job. Delivering the document to the
browser is what a w eb server should worry about. So, for example, if a document is
requested by the URL
/general/introduction.html, then, using the Windows local file
system, this will translate to
c:/general/introduction.html, if the request originates from
the
C: drive. However, if the document is requested through a web ser ver, the server
could translate the path to some other location, for example
c:/users/meandyou/www/
general/introduction.html
.
Mike: What’s the point?
Professor: The
/general/introduction.html URL is a ro ot-relative URL. If you are ac-
cessing the
introduction.html file directly through the local file system, then there is
only one possible location for the file: in the
general directory, whic h in turn should
be placed in the root directory of the drive. However, if you are accessing the file
through a web server, then you can configure the server to prepend any path you like
to the given root-absolute URL.
Maria: That’s great! Now we can choose any directory we want to be our site roo t
and use root-r elative URLs in navigation menus. Is it difficult to run a server?
Professor: It depends on what type of server you n eed. Fortunately, you will not have
to set up a p roduction server, which is a complex task indeed. A production server
(also called a live server) serves a website th at can be viewed by the public. As for
now, you better leave this to one of the many web hosting companies, whose services
you can rent quite cheaply.
For developing and testing your website, you need a development (also named stag-
ing) server, wh ic h runs locally on your computer and is not accessible by the public.
Setting up this kind of server is fairly trivial and I think you cou ld do it by yourselves.
Since you both run Windows, you’ll need a so-called WAMP pa ckage. WAMP is an
acronym formed f rom the initials of the operating sy stem Microsoft Windows and the
three main compone nts of the pa ckage: Apache, wh ic h is a web server, MySQL, an
open-so urce database, an d one of three scripting langu ages: PHP, Perl, o r Python.
Don’t worry about the m, though. We will not use them in our course.
One of the many WAMP p ackages is EasyP H P (
www.easyphp.org), which is a n open
source project and therefore freely available. Just go to their website and download
and install the EasyPHP DevServer. During the installation , you don’t have to do
anything except decide to which directory you want the software to install. After the
installation has co mpleted, you will find a directory named
data/localweb just inside
the directory you have chosen for the in stallatio n. This is your website home, or root
directory, and voilà, that’s it!
When you build a web site, you usually save your main page (the one that a visitor
should see first) to a file named
index.html in the site root directory. This name can be
3.2. Setting up a Web Server 37