How to Design Programs: An Introduction to Programming and Computing

Info icon This preview shows pages 1–9. Sign up to view the full content.

Web Server Manual Mike Burns ([email protected]) Greg Pettyjohn ([email protected]) Jay McCarthy ([email protected]) December 28, 2007
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Copyright notice Copyright c 1996-2007 PLT Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Library General Public License, Version 2 published by the Free Software Foundation. A copy of the license is included in the appendix entitled “License.”
Image of page 2
Contents 1 Quick Start 1 1.1 Quick Start on Unix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 I Administration 2 2 Directory Structure 3 3 Configuration 4 3.1 Named Virtual Hosts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.2 The Configuration Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.2.1 Managing Virtual Hosts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.3 Configuration File Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.3.1 Host Table Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4 Passwords 9 5 Starting the Server 10 6 Monitoring the Server 11 II Programming 12 7 Before You Begin 13 7.1 Reloading the Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 7.2 Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 8 Static Content 14 9 Writing Servlets 15 i
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

CONTENTS CONTENTS 9.1 Module-Based Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 10 Servlet Library 17 10.1 Data Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 10.1.1 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 10.1.2 Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 10.1.3 Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 10.2 Core Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 10.3 Helpful Servlet Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 10.4 Example Multiplication Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 10.5 Example Math Test Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 10.6 Servlet Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 11 Semi-Internal Functions 25 11.1 Starting the Server from a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 11.2 Constructing Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 11.3 Monitoring the Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 11.3.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 License 28 Index 32 ii
Image of page 4
1. Quick Start To just use a servlet without caring about administrative or programming details: 1.1 Quick Start on Unix 1. If you have root access, just run plt/bin/web-server ; otherwise, run plt/bin/web-server -p 8080 . 2. Example servlets are located in collects/web-server/default-web-root/servlets/examples/ . 3. To run the example servlet add.ss , use the URL . ss , or if the server was started with -p 8080 . 1
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Part I Administration 2
Image of page 6
2. Directory Structure By default, the configuration tool (see section 3.2 ) organizes files containing the Web server’s configurations, docu- ments, and servlets in one directory tree per virtual host. This tool can be used to manage all trees for the Web server. A default tree exists in collection/web-server/ , which looks like: configuration-table default-web-root conf servlet-error.html forbidden.html servlet-refresh.html passwords-refresh.html not-found.html protocol-error.html htdocs Defaults index.html documentation ... log passwords servlets configure.ss my-other-host conf ... htdocs ... log passwords servlets still-another-host ... Files may be relocated or shared between hosts by editing the details for that host using the configuration tool. For more on virtual hosts, see section 3.1 . 3
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

3. Configuration 3.1 Named Virtual Hosts Many Web sites can be served from one Web server process through the use of virtual hosting. When a client (Web browser) sends a request to the server, the domain name is embedded in the request. The Web server can then service the request in different ways based on that requested domain name.
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '07
  • Fisler
  • Web server, configuration file, General Public License

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern