Sie sind auf Seite 1von 8

Chapter 6 Configuring a Web Server

At a Glance

Instructors notes
Chapter Objectives Instructor Notes Discussion Topics Quick Quizzes Key Terms

CHAPTER OBJECTIVES
Understand how a Web server works Install IIS and Apache Web servers Examine the IIS and Apache properties Host multiple Web sites Configure new Web sites in IIS and Apache Understand virtual directories

INSTRUCTOR NOTES
How a Web server works The HTTP (Hypertext Transfer Protocol) defines how information is passed between browser and Web server. The two most popular Web servers are: Apache from Apache Software Foundation Internet Information Services (IIS) from Microsoft The original Web server from Microsoft available on Windows NT was Internet Information Server, now it is called Internet Information Services Almost two-thirds of all Web servers use Apache As is true with other servers such as DNS, Web servers listen for communication at a port and the default port is 80. You can also create Web servers at port numbers greater than 1023. Each Web server has a root, which is where you store the HTML documents Understanding HTTP The current version of HTTP is 1.1. Virtually no browsers are so old that they do not support 1.1. HTTP is a stateless protocol, meaning that each Web page sent is independent of every other Web page sent. This makes it more challenging to create a shopping cart application. HTTP 1.1 supports persistent connections which allows the browser to receive multiple files in one TCP connection. This can speed up communication. Although you see a single page in your browser, it can be composed of many text and image files When the browser sends a request to a Web server, it looks like: GET /hello.htm HTTP/1.1 Host: www.technowidgets.com The above requests the hello.htm file from the root of the Web server. It specifies the host of www.technowidgets.com. There could be multiple hosts at the IP address. The following shows some of the headers along with the HTML that the Web server would send: HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Content-Type: text/html Last-Modified: Fri, 17 May 2005 18:21:25 GMT Content-Length: 43 <html><body> Hello, World </body></html> The headers, which are on lines 2 to5, contain information about the page Features in Apache

Apache 1.3 was used for many years but version 2.0 was released in 2001. Apache can also be used as a proxy server. A proxy server isolates your real Web server from the Internet. Apache 2.0 has: Better support for Windows Support for IPv6 Simplified configuration Unicode support in Windows Multilanguage error responses Apache supports many programming languages such as Perl and PHP Features in IIS IIS versions associated with Windows versions Windows NT 4.0 Windows 2000 5.0 Windows Server 2003 6.0 SMTP can be easily added so you can send e-mail from your Web pages Web Distributed Authoring and Versioning (WebDAV) allows server to share Webbased files. Named virtual hosting allows multiple Web sites can share a single IP address. Per Web site bandwidth throttling controls bandwidth by Web site IIS also supports Kerberos authentication and Secure Sockets Layer 3.0 encrypted communication Features in IIS 6.0 Increased security Default permits only HTML documents Expanded language support Can use XML and SOAP Support for IPv6 Increased dependability Kernel-mode HTTP service Self-healing mechanism Components in IIS File Transfer Protocol (FTP) server allows you to transfer files between user and server FrontPage 2000 Server Extensions is used by programs to transfer files to and from a Web site. The NNTP Service is used to create user forums. The SMTP Service is for sending e-mail and of course, it has the World Wide Web Server component which implements the Web server

QUICK QUIZ
1. True/False. Web servers typically listen at port 8080. Answer: False 2. True/False. Secure Sockets Layer 3.0 supports encrypted communication. Answer: True 3. HTTP stands for what? Answer: Hypertext Transfer Protocol

4. The location where HTML documents are stored on the Web server is called what? Answer: root

Installing Apache Apache can be installed when you install Linux. It is also on Red Hat CD 2. If you install it from the Red Hat CD, the directories will be consistent with other server applications. However, if you download it from the Apache Web site, you have to compile it and install it (which is easy). Starting Apache By default, Apache does not start after you install it. The following table has a list of commands: apachectrl start apachectrl stop apachectrl restart Minimal Apache configuration Add a ServerName in /etc/httpd/conf/httpd.conf Add apachectl start to /etc/rc.d/rc.local Default Web Site Properties in IIS Tabs on the Default Web Site Properties dialog box Operators (Windows 2000) only - Lists users who can administer Web site performance. You can limit bandwidth by Web site. You can also limit simultaneous connections (Windows 20003) ISAPI Filters - Specify applications that process HTTP requests Home Directory - Location and properties of the root. It contains logging information and permissions Documents - Configure name for default Web page HTTP Headers - Add your own custom headers Custom Errors - Create custom pages for HTTP errors Apache Properties Global Environment ServerRoot - Directory location of server files KeepAlive - Indicates whether Apache should maintain a persistent connection Listen - Determines the port number for the server. The default is 80 Main server configuration User - Shows the user name that Apache employs when someone requests a Web page. The user is default is apache ServerAdmin - E-mail address of administrator ServerName - DNS host name or IP address of server DocumentRoot - Directory where the Web pages are stored

QUICK QUIZ
1. True/False. The command to restart Apache is: apachectrl restart. Answer: True 2. True/False. You can have more than one IP address associated with a single computer. Answer: True 3. The version of Apache covered in the text is what? Answer: 2.0 4. The name of the file that you edit to make Apache start when you start the computer is called what? Answer: rc.local

Hosting Multiple Web sites There are three ways to host multiple Web sites. 1. By port number. You associate each new Web site with a port above 1023. To retrieve a Web page from a site at port 8080, you would type www.technowidgets.com:8080/prod.htm. Because it requires user to add port number, it is not a popular method 2. By IP address. You can create multiple IP addresses on a single NIC. They are referred to as virtual IP addresses. It is useful for flexibility because if each domain has its own unique IP address, you can easily move the domain to a different Web server. However, it is getting more expensive to get multiple IP addresses from an ISP so the following is a viable alternative. 3. By host name. Multiple host names can be associated with a single IP address. Getting a single IP address from your ISP is relatively inexpensive. You can host an almost unlimited number of domains with a single IP address. It is the most common method of hosting. Configuring virtual host based on IP address in Apache In /etc/rc.d/rc.local, add an IP address such as: /bin/ifconfig eth0:0 192.168.0.150 In the Virtual Host section of httpd.conf <VirtualHost 192.168.0.150> ServerName research.technowidgets.com DocumentRoot /var/www/research </VirtualHost> Configuring virtual host based on host name in Apache NameVirtualHost defines the common IP address Multiple configurations repeat the same IP address and define unique ServerName settings. For example, the following defines both www.technowidgets.com and web1.techowidgets.com at 192.168.0.100:
NameVirtualHost 192.168.0.100 <VirtualHost 192.168.0.100>

ServerName www.technowidgets.com DocumentRoot /var/www/html </VirtualHost> <VirtualHost 192.168.0.100> ServerName web1.technowidgets.com DocumentRoot /var/www/web1 </VirtualHost>

Configuring a virtual directory in Apache The following associates the virtual directory called prod with the location of the directory
Alias /prod/ /var/www/prod/ Then it configures the directory <Directory /var/www/prod> AllowOverride None Order allow, deny Allow from all </Directory>

QUICK QUIZ
1. True/False. In Linux, to associate a virtual directory called test with the directory /var/test, the first word in the statement would be Virtual. Answer: False 2. What do you call a Web directory that is not physically located beneath the Web root? Answer: Virtual Directory 3. The easiest and most common way to host Web sites is by what method? Answer: host name

Discussion Topics
1. Which Web server do you think is best and why? 2. Which Web server do you think is easier to configure and why?

Key Terms
Hypertext Markup Language (HTML) The formatting language that browsers use to display text and graphics. Hypertext Transfer Protocol (HTTP) A protocol that defines how information is passed between the browser and the Web server. ISAPI filters Applications that process HTTP requests. For example, Microsoft Exchange installs an ISAPI filter to process Web e-mail. Network News Transfer Protocol (NNTP) A protocol used in News servers to create threaded discussions in a newsgroup. newsgroup A group that shares an interest in information on a specific topic, such as comp.os.linux.security, a newsgroup devoted to Linux security issues, or alt.volkswagen.beetle, a newsgroup for Volkswagen Beetle owners and fans. persistent connections Allows the browser to receive multiple files in one TCP connection. root The physical location on the Web server where you store your Web pages. stateless When a protocol is stateless (as is HTTP, for example), each Web page sent to the user is independent of every other Web page that the server sends.

Das könnte Ihnen auch gefallen