Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 29 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
29
Dung lượng
262,5 KB
Nội dung
WebServerAdministration Chapter Configuring a WebServer Overview Understand how a Webserver 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 How a WebServer Works HTTP (Hypertext Transfer Protocol) defines how information is passed between a browser and a Webserver The two most popular Web servers are Apache from Apache Software Foundation Internet Information Services (IIS) from Microsoft The original Webserver from Microsoft available on Windows NT was Internet Information Server Almost two-thirds of all Web servers use Apache How a WebServer Works As is true with other servers such as DNS, Web servers listen for communication at a port The default port is 80 You can also create Web servers at port numbers greater than 1023* Each Webserver 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 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 Understanding HTTP HTTP 1.1 supports persistent connections This 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 Understanding HTTP 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 Webserver It specifies the host of www.technowidgets.com There could be multiple hosts at the IP address Understanding HTTP The following shows some of the headers along with the HTML that the Webserver 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 Hello, World The headers 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 Apache 2.0 has A proxy server isolates your real Webserver from the Internet 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 – IIS 4.0 Windows 2000 – IIS 5.0 Windows Server 2003 – IIS 6.0 SMTP can be easily added so you can send e-mail from your Web pages Starting Apache By default, Apache does not start after you install it The following table has a list of commands Procedure Command Start Apache apachectl start Stop Apache apachectl stop Restart Apache apachectl 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 Performance This property lists users who can administer Web site Limit bandwidth by Web site Limit simultaneous connections (Windows 2003) ISAPI Filters Specify applications that process HTTP requests Tabs on the Default Web Site Properties Dialog Box Home Directory Documents Configure the name for default Web pages HTTP Headers Specifies the location and properties of the root Log information here Permissions Add your own custom headers Custom Errors Create custom pages for HTTP errors Apache PropertiesGlobal Environment ServerRoot KeepAlive Directory location of server files Indicates whether Apache should maintain a persistent connection Listen Determines the port number for the server Default is 80 Apache PropertiesMain Server Configuration User ServerAdmin E-mail address of administrator ServerName Shows the user name that Apache employs when someone requests a Web page The default is apache DNS host name or IP address of server DocumentRoot Directory where the Web pages are stored Hosting Multiple Web Sites by Port Number Associate each new Web site with a port above 1023 To retrieve a Web page from a site at port 8080 www.technowidgets.com:8080/prod.htm Because it requires a user to add the port number, it is not a popular method Hosting Multiple Web Sites by IP Address You can create multiple IP addresses on a single NIC Referred to as virtual IP addresses Useful for flexibility because if each domain has its own unique IP address, you can easily move the domain to a different Webserver It is getting more expensive to get multiple IP addresses from an ISP Hosting Multiple Web Sites 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 a Virtual Host Based on an 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 ServerName research.technowidgets.com DocumentRoot /var/www/research Configuring a Virtual Host Based on a Host Name in Apache NameVirtualHost defines the common IP address Multiple configurations repeat the same IP address and define unique ServerName settings NameVirtualHost 192.168.0.100 ServerName www.technowidgets.com DocumentRoot /var/www/html ServerName web1.technowidgets.com DocumentRoot /var/www/web1 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 AllowOverride None Order allow, deny Allow from all Summary Web servers use HTTP to send HTML documents IIS is from Microsoft while Apache is from Apache Software Foundation IIS modifications are made through property pages Apache modifications are typically made by changing /etc/httpd/conf/httpd.conf Summary You can create multiple Web sites on a single computer by adding port numbers, IP addresses, and/or host names Virtual directories are directories that appear to be located beneath the root, yet are physically located elsewhere ... original Web server from Microsoft available on Windows NT was Internet Information Server Almost two-thirds of all Web servers use Apache How a Web Server Works As is true with other servers... virtual directories How a Web Server Works HTTP (Hypertext Transfer Protocol) defines how information is passed between a browser and a Web server The two most popular Web servers are Apache...Overview 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