MT72MT84MT84MT80MT32MT114MT101MT113MT117MT101MT115MT116MT32MT40MT71MT69MT84MT44M

MT72MT84MT84MT80MT32MT114MT101MT113MT117MT101MT115MT116MT32M...

This preview shows page 7 - 10 out of 49 pages.

MT72MT84MT84MT80MT32MT114MT101MT113MT117MT101MT115MT116MT32MT40MT71MT69MT84MT44MT32MT80MT79MT83MT84MT44MT32MT72MT69MT65MT68MT32MT109MT101MT116MT104MT111MT100MT41 MT72MT84MT84MT80MT32MT114MT101MT115MT112MT111MT110MT115MT101MT32MT40MT99MT111MT110MT116MT101MT110MT116MT41 MT84MT67MT80MT32MT99MT108MT111MT115MT101MT32MT40MT70MT73MT78MT44MT32MT65MT67MT75MT41 Figure 2.3 : Request for a webpage Source : Reilly 2002, 4, fig. 2. The next activity illustrates how Web servers and browsers communicate via network ports. In the following activity, you will start a Web server which ‘listens’ for requests on a different TCP/IP port from the default HTTP port (80). Upon successfully completing this exercise you will have two Web servers running on your local computing platform, each Web server listening on a separate port.
Image of page 7
X UNIT 2 WEB SERVER AND HTTP 54 1. Start your localhost Web server which is configured to listen to port 80 (as specified in httpd.conf ). 2. Create a new version of the configuration file ( httpd.conf ) so that the server now listens to port 8080 and records its process ID to a file called httpd8080.pid . Change the following directives and save the new configuration file as httpd8080.conf in the logs directory: Listen 8080 PidFile logs/httpd8080.pid 3. On the command line, start another server using this new configuration by issuing the command: % httpd -f xxxx/httpd8080.conf where xxxx is the path where httpd8080.conf can be found. 4. Retrieve a Web document on the Web server listening to port 8080: Note how the URL is formed by attaching the port number to the host name, using a colon to separate the two. 5. Retrieve the same Web document on the Web server listening to port 80: The default port 80 is assumed since no port number was explicitly provided in the URL. 6. Use the netstat command and observe that there are two Apache Web server processes running. This proves that even though you viewed the same homepage twice, it was served to you by two different Web servers, depending on the port number used. 7. Terminate or ‘kill’ the Web server on port 8080 using % kill PID where PID is the process ID of the Web server as recorded in logs/httpd8080.pid . You may also terminate the Web server on port 80 in a similar manner. The process ID for this Web server will be in logs/httpd.pid. Note: Setting up two Web servers listening to different ports can be even more useful when each server serves different sets of documents. For example, the employees of ABC Books may be given access to a different website from the ordinary public. Employees access this special website at , while their customers continue to access the public website at . You will learn how to assign different sets of documents to Web servers in Activity 2.4. ACTIVITY 2.2
Image of page 8
UNIT 2 WEB SERVER AND HTTP W 55 DOCUMENT In the previous section, you learned that the Web server’s main job is sending documents over the network. Without documents to serve there would no reason for the Web server to exist! From the beginning, Tim Berners-Lee envisioned the
Image of page 9
Image of page 10

You've reached the end of your free preview.

Want to read all 49 pages?

  • Fall '16
  • World Wide Web, Web server, Web browser, Hypertext Transfer Protocol

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture