<br />IIS 7.0 for Apache Administrators<br />Published: March 2009<br />Contents<br /> TOC o "
1-2"
 Overview PAGEREF _To...
Module:FastCgiModule
Executable:c:phpphp-cgi.exe
Name:PHP via FastCGI</li></ul>Click on the OK button to commit the settings, then Yes on the confirmation dialog box that ...
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
IIS 7.0 for Apache Administrators
Upcoming SlideShare
Loading in...5
×

IIS 7.0 for Apache Administrators

1,321

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,321
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
71
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "IIS 7.0 for Apache Administrators"

  1. 1.  <br />IIS 7.0 for Apache Administrators<br />Published: March 2009<br />Contents<br /> TOC o " 1-2" Overview PAGEREF _Toc225160481 h 1<br />Introduction to IIS 7.0 PAGEREF _Toc225160482 h 2<br />Extensible Modular Architecture PAGEREF _Toc225160483 h 2<br />Enhanced Web Server Security PAGEREF _Toc225160484 h 2<br />Improved Management Tools PAGEREF _Toc225160485 h 3<br />Diagnostics & Troubleshooting PAGEREF _Toc225160486 h 3<br />Strong Web Application Support PAGEREF _Toc225160487 h 4<br />Flexible Extensibility Model for Customization PAGEREF _Toc225160488 h 4<br />FTP Publishing Service for IIS 7.0 PAGEREF _Toc225160489 h 5<br />Integrated Request Pipeline PAGEREF _Toc225160490 h 6<br />IIS 7.0 Configuration and Management PAGEREF _Toc225160491 h 7<br />Configuring IIS 7.0 PAGEREF _Toc225160492 h 7<br />Hosting PHP on IIS 7.0 PAGEREF _Toc225160493 h 10<br />Installing FastCGI Support PAGEREF _Toc225160494 h 10<br />Installing and Configuring PHP on IIS 7.0 PAGEREF _Toc225160495 h 10<br />Configure IIS 7.0 to Handle PHP Requests PAGEREF _Toc225160496 h 11<br />Using Modules to Control and Customize IIS PAGEREF _Toc225160497 h 12<br />Distributed Configuration Model PAGEREF _Toc225160498 h 17<br />Administration Using IIS 7.0 PAGEREF _Toc225160499 h 19<br />Customizing Error Messages PAGEREF _Toc225160500 h 19<br />URL Rewriting PAGEREF _Toc225160501 h 22<br />Web Caching PAGEREF _Toc225160502 h 24<br />Web Output Compression PAGEREF _Toc225160503 h 28<br />Diagnostics and Troubleshooting PAGEREF _Toc225160504 h 31<br />Apache PAGEREF _Toc225160505 h 31<br />IIS 7.0 PAGEREF _Toc225160506 h 31<br />Securing the Web Server PAGEREF _Toc225160507 h 36<br />Conclusion PAGEREF _Toc225160508 h 38<br />IIS 7.0 Resources PAGEREF _Toc225160509 h 39<br />Overview<br />This white paper provides Apache administrators with detailed technical information about Internet Information Services (IIS) 7.0. It describes the architecture, security model, management features, and other new enhancements included in this release. It also compares common IIS 7.0 and Apache management scenarios and tools. <br />This document also examines how each Web server platform integrates with application, database, and management solutions, and how ease of management can be maintained as the Web server environment grows. Finally, this document examines the powerful diagnostic, troubleshooting, and reporting tools that can help simplify the maintenance of Web applications running on IIS 7.0. <br />Introduction to IIS 7.0<br />IIS 7.0 is the most powerful Web server from Microsoft to date, providing new capabilities that dramatically improve the way Web solutions are developed, deployed, and managed. IIS 7.0, with a modular design similar to that of Apache Web Server, gives administrators superior control through its extensible architecture, an intuitive graphical user interface, and greater ability to customize their Web servers, resulting in improved efficiency when deploying and managing Web applications. In addition, the powerful diagnostic capabilities built into IIS 7.0 reduce the time required to troubleshoot issues, resulting in minimized downtime.<br />Extensible Modular Architecture<br />In previous versions of IIS, all functionality was built in by default. In effect, all features were installed regardless of the intended use of the IIS server, and there was no easy way to extend or replace any of that functionality. In IIS 7.0, the core Web server has been completely re-engineered and replaced by a wholly modular architecture that offers greater flexibility and the following three key benefits:<br />Componentization<br />Extensibility<br />ASP.NET integration<br />The functionality of IIS 7.0 is divided into more than 44 separate feature modules. These modules can be installed during the setup of the Web Server (IIS) role through the Server Manager console. The existent functionality can be extended further using the included Win32 and .NET APIs to build new modules.<br />While the IIS 7.0 modules replace Internet Server Application Programming Interface (ISAPI) filters and extensions, IIS 7.0 maintains full support of these filters and extensions. Apache Web Server provides limited support for SAPI extensions but does not support ISAPI filters. It has a famous community-driven project called Apache Portable Runtime (APR), used to create and maintain software libraries that provide a predictable and consistent interface to underlying platform-specific implementations. APR provides a set of APIs that maps to the underlying operating system, and hence allows developers to code platform-independent programs.<br />Enhanced Web Server Security<br />Since 2003, four security vulnerabilities have been reported on IIS 6.0, compared with 23 for Apache 2.0.x during the same period, according to Secunia, the security service provider. IIS 7.0 builds on top of the secure foundation of its predecessor, and brings an enhanced process model that isolates applications by sandboxing resources and configurations at the application level by default.<br />Installing a minimal environment by choosing the Server Core installation option of Windows Server 2008 further limits the area of exposure of the IIS 7.0 installation. Server Core omits graphical services and most libraries, reducing the total footprint of the operating system while still retaining the ability to be administered both locally via the IIS command-line utility APPCMD.EXE as well as remotely. <br />Improved Management Tools<br />Apache’s initial design did not take into account the possibility of implementing a graphical interface for its management tools. Apache management functions are accomplished through entries made directly into configuration files, or through open source graphical management tools such as TKApache and NetLoony, which are available for download.<br />In contrast, IIS 7.0 offers a range of management tools that cater to any Web site administrator’s personal taste. Day-to-day management can be accomplished graphically, via the command line, or by manually editing the configuration file. These tools give administrators greater control and easier access to the sites they manage.<br />The following management tools are integrated into IIS 7.0.<br />IIS Manager, a graphically rich console, provides access to IIS configuration settings, ASP.NET, and other IIS modules, in addition to user data and runtime diagnostic information. IIS Manager allows administrative control over sites to be delegated to developers or content owners, reducing the server administrator’s day-to-day responsibilities. The new IIS Manager supports remote administration over HTTPS, allowing for administration over the Internet without requiring DCOM or the opening of other ports on the firewall.<br />APPCMD.EXE, a new command-line tool, simplifies common management Web server tasks. It exposes all key server management functionality through a set of 10 objects that can be manipulated from the command line or from scripts.<br />Windows PowerShell Provider for IIS 7.0 makes available more than 75 task-based cmdlets that address key day-to-day activities, such as creating Web sites and enabling request tracing. Another set of low-level configurations enables access to every IIS configuration setting in addition to any other custom configuration.<br />Microsoft.Web.Administration, a simple and comprehensive application programming interface (API), gives developers convenient access to server objects and the ability to manipulate XML configuration files.<br />Windows Management Instrumentation provider, which includes tools that let developers view and edit objects in a common information repository and run selected methods to edit IIS configuration settings.<br />Web Deployment Tool, another free download, helps keep sites and servers in sync with IIS 6.0 or IIS 7.0, and assists administrators in migrating sites from IIS 6.0 to IIS 7.0.<br />Administration Pack for IIS 7.0, a set of extension modules designed to help with a variety of administrative tasks.<br />Diagnostics & Troubleshooting<br />In Apache, faults are isolated and diagnosed through five log files, each of which must be read manually to search for patterns that point to a particular problem.<br />IIS 7.0 includes two mechanisms to help with diagnostics and troubleshooting. One gives the administrator a real-time view of requests running on the server; the other allows the administrator to set traps to catch hard-to-reproduce error conditions and write a detailed trace log.<br />Runtime State and Control API provides real-time state information about application pools, worker processes, sites, application domains, and even running requests. This COM API is displayed through the IIS Manager console, the new APPCMD.EXE command-line tool, and Windows Management Instrumentation (WMI). These applications offer quick and easy status checks in any management environment chosen.<br />Detailed event tracing functionality tracks events throughout the request and response path, allowing developers and administrators to trace a request through the IIS processing pipeline and back out to the response. These detailed tracing events collect information on the request path, errors raised by the request, and the elapsed time at all points.<br />IIS 7.0 also simplifies troubleshooting by providing an improved, more detailed, and more actionable library of error messages. This library replaces the traditional terse error codes with detailed information about the request, the possible cause of the error, and suggested steps to fix the problem. IIS 7.0 now sends detailed error information to the browser and other remote clients.<br />Strong Web Application Support<br />IIS 7.0 offers powerful and easy-to-use tools that enable organizations to manage all of their Web applications on a single platform, eliminating the need to maintain two or more independent platforms that create higher infrastructure costs.<br />FastCGI is a new feature of IIS 7.0 that supports the high-performance version of the Common Gateway Interface (CGI). FastCGI overcomes the performance problems of standard CGIs by creating persistent processes that can be reused for multiple requests, rather than creating a new process for each request, which is then discarded when the request has been filled. FastCGI also allows applications to run remotely, improving load distribution.<br />IIS 7.0 also operates with Microsoft .NET Framework version 1.1 and later, creating a combination of new technologies for developing applications that deliver a visually compelling user experience, communication across technology boundaries, identity management, and support for a wide range of business processes. The newer versions of .NET Framework 3.0 simplify development through a consistent and comprehensive environment, enabling developers to build solutions compatible with a variety of mobile devices, backend services, and applications. Through its support of classic ASP, ASP.NET, and PHP, IIS 7.0 provides organizations with the flexibility to write applications in the language of their choice and to host applications on the platform of their choice.<br />Flexible Extensibility Model for Customization<br />IIS 7.0 gives software developers a complete server platform on which to build Web server extensions. Developers can extend IIS to provide custom functionality through the all-new core server API set. This API set allows developers to build modules in both native code such as C/C++ and managed code using languages such as C# and Visual Basic® using .NET Framework. It was also used to implement a significant portion of the IIS 7.0 feature set for request and application processing. IIS 7.0 also enables extensibility for configuration, scripting, event logging, and administration tool feature sets.<br />These extensions are available for download at no charge for x86 and x64 platforms. They cover a range of tasks in deployment, administration, request handling, security, content publishing, and media service. As of November 2008, the following extensions were available:<br />ToolFunctionWeb Deployment Tool Helps keep sites and servers in sync with IIS 6.0 or IIS 7.0, as well as migrate from IIS 6.0 to IIS 7.0.PowerShell Provider for IIS 7.0A PowerShell snap-in that allows for management of IIS 7.0 configuration and runtime data.Administration Pack for IIS 7.0A set of six modules designed to help with a variety of administrative tasks. Database Manager for IIS 7.0A spin-off from the Administration pack that allows for easy management of databases through the IIS Manager UI. IIS Manager for Remote AdministrationAllows end-users and administrators to remotely manage IIS 7.0 servers from Windows Vista, Windows XP, and Windows Server 2003. URL Scan 3.0Restricts the types of HTTP requests that IIS will process.URL RewriterProvides a rule-based rewriting mechanism for changing request URLs before the Web server processes them.Application Request RoutingA proxy-based routing module that forwards HTTP requests to content servers based on HTTP headers, server variables, and load balance algorithms. FTP for IIS 7.0A new FTP service that has been completely rewritten for Windows Server 2008.WebDAV for IIS 7.0Improved WebDAV extension module that enhances Web authors’ ability to publish content and offers Web administrators more security and deployment options.Bit Rate ThrottlingOffers a range of functionality for controlling download rates for media and other content.Web Playlists for IIS 7.0Allows server-controlled media playlists to be delivered from the Web server infrastructure rather than from a dedicated streaming media server.<br />FTP Publishing Service for IIS 7.0<br />FTP Publishing Service for IIS 7.0 (FTP 7) offers many enhanced capabilities over previous releases of the IIS FTP server. In addition to standard FTP functionality, through a new management UI the new service offers administration, support for current security standards, and support for virtual sites.<br />The following are selected highlights of the new FTP release: <br />Tighter integration with IIS 7.0 through a new administration UI and configuration store based on the .NET XML-based *.CONFIG format.<br />Support for FTP over SSL and for the use of non-Windows accounts for authentication. The new FTP service also supports other Internet improvements, such as UTF8 and IPv6.<br />Shared hosting improvements through full integration into IIS 7.0. This allows FTP 7 to host FTP and Web content from the same site by simply adding an FTP binding to an existing Web site. In addition, the FTP service now has virtual host name support, making it possible to host multiple FTP sites on the same IP address.<br />Improved logging and supportability features, including enhanced logging for all FTP-related traffic, unique tracking for FTP sessions, FTP sub-statuses, and additional detail fields in FTP logs. <br />Integrated Request Pipeline<br />In previous versions of IIS, ASP.NET was implemented as an IIS ISAPI extension. Requests to non-ASP.NET content, such as ASP pages or static files, were not visible to ASP.NET. Thus, services provided by ASP.NET modules and custom ASP.NET application code were not available to non-ASP.NET requests.<br />In IIS 7.0, the layout of the request pipeline allows for greater opportunities to influence the way in which a request is handled. Instead of the ASP.NET request processing pipeline plugging into the IIS pipeline, IIS 7.0 provides a wrapper around the IIS pipeline. IIS 7.0 processes a request to any content type, which enables services provided by ASP.NET modules such as forms authentication or output cache to be used for requests to ASP pages, PHP pages or static files.<br />IIS 7.0 Configuration and Management<br />Configuring IIS 7.0<br />In Apache, configuration starts with a directive entry in the httpd.config file. <br />This method is similar for IIS 7.0 configuration, in which most settings can be configured either locally in the web.config file or globally in the ApplicationHost.config file. In IIS 7.0, configuration is based on the existing .NET Framework configuration store, which allows IIS configuration settings to be stored in web.config files alongside ASP.NET configuration settings. <br />IIS 7.0 provides a few methods for editing the .CONFIG files. These methods include:<br />Graphically through the IIS Manager console by clicking on the Application Settings icon in the default Features View, and then selecting Edit to open an Edit Application Setting dialog box.<br />From the command line by using APPCMD.EXE along with the set config / commit argument/.<br />Within a Windows Management Instrumentation script, using Application class.<br />Manually editing the configuration files. The IIS 7.0 configuration files are based on a strongly typed schema written in clear-text XML. This XML schema divides the configuration files into logical sections and makes them extremely simple to read and edit. One can use Visual Web Developer 2005 Express to edit the IIS 7.0 configuration files in a neat-looking code editor environment.<br />Online documentation for all of these methods is available through the Microsoft Web site.<br />The following table lists the settings that may be changed using any of these editing methods.<br />SettingFunctionalityApplication SettingsApplication-wide values that reside in a central location and can be accessed from anywhere in the application.ASP (classic)View the default settings or edit them as needed.CGIView the default settings or edit them as needed.CompilationMake changes to the way managed code is compiled. Managed code must first be compiled into one or more Dynamic Link Library (DLL) files before IIS can process it. Either use the default compilation settings or edit them as needed.Database Connection StringsCreate a string in IIS to store the information that an application uses to connect to the database.E-mailSet the Simple Mail Transfer Protocol (SMTP) server for delivery method and delivery location. IIS can immediately deliver e-mail messages from a site or store them for delivery later. GlobalizationRegional and language settings for applications.ISAPI FiltersDLL files that modify or enhance IIS functionality. ISAPI filters can be added to the IIS configuration.Machine KeysSettings for machine keys to configure encryption and decryption methods in addition to validation and encryption keys.Pages and ControlsSupports the global setting of certain ASP.NET page and control directives. Globally setting these directives will change all pages and controls within the scope of the configuration file.ProfilesDefine information to maintain about each user visiting the site or application. Use this feature to add, edit, or delete user profiles.ProvidersConfigure ASP.NET providers for membership user roles and profiles, and select the default provider for these provider-based services.Session StateASP.NET session state allows for the storage and retrieval of values for a user as the user navigates through the different ASP.NET pages of an application.<br />The complete list of available settings can be determined by running the following command:<br />Appcmd list config /section:?<br />Figure 1: appcmd.exe list of configuration of options<br />Figure 2: appcmd.exe list of configuration of options<br />The complete usage options of appcmd.exe can be found at http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/.<br />Hosting PHP on IIS 7.0<br />Installing FastCGI Support<br />FastCGI is a language-independent, scalable, open extension to CGI that provides high performance for Internet applications. The FastCGI extension improves performance and stability in application frameworks such as PHP on IIS. <br />To enable FastCGI on Apache requires manually moving the mod_fastCGI files and then manually editing configuration files to load modules on startup. In some Linux distributions, the mod_fastCGI files must first be built.<br />Enabling FastCGI support on IIS 7.0 in Windows Server 2008 is handled entirely through the Server Manager console.<br />From the Start menu, open Server Manager. <br />Select Roles, then Web Server (IIS) Role. Then select Add Role Services. From the list of Role Services, check CGI and click Next. This enables both CGI and FastCGI services.<br />Figure 3: Adding CGI through the Role Services window<br />Installing and Configuring PHP on IIS 7.0<br />Microsoft recommends using a nonthread safe build of PHP with IIS 7.0 FastCGI. The nonthread safe build of PHP provides significant performance gains over the standard build by not executing any thread-safety checks. These checks are unnecessary, since FastCGI is not tied to a particular server architecture and applications can be single or multithreaded.<br />The nonthread safe build is available for download at http://www.php.net/downloads.php. Create the folder c:PHP and unpack the files into it. From these files, rename the php.ini-recommended file to php.ini. In the php.ini file, enter the following settings:<br />Set fastcgi.impersonate = 1. FastCGI under IIS supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context under which the request runs.<br />Set cgi.fix_pathinfo = 1. Cgi.fix_pathinfo provides real PATH_INFO/PATH_TRANSLATED support for CGI. For more information on PATH_INFO, see the CGI specs. This setting causes PHP CGI to fix its paths to conform to the spec.<br />Set cgi.force_redirect = 0.<br />Set open_basedir to point to the folder or network path in which the Web site content is located.<br />To test whether the PHP installation was successful, run the following command from the command line prompt:<br />C:PHP>php –info <br />If PHP was installed correctly and all of its dependencies are available on the machine, this command will display information on the current PHP configuration, such as the following.<br />Figure 4: PHP Configuration data<br />Configure IIS 7.0 to Handle PHP Requests<br />Handler mapping is required for IIS 7.0 to host PHP applications. This handler mapping tells IIS to pass all requests for PHP files to the PHP application framework via the FastCGI protocol.<br />In Apache, PHP handler is configured mainly in php.conf, with other PHP parameters in VirtualHost containers of the main httpd.conf file and in the VirtualHost includes files in /usr/local/apache/conf/userdata. Some editing of php.conf can be done through Web Host Manager under Configure PHP and SuExec.<br />In IIS 7.0, handler mapping can be added and configured through the UI. Open the IIS Manager, select the top node—usually the server name—in Connections, and then click on the Handler Mappings icon in the center pane.<br />Figure 5: Accessing Handler Mappings <br />From the Handler Mappings window, select Add Module Mapping and enter the following settings in the module mapping fields:<br /><ul><li>Request path:*.php
  2. 2. Module:FastCgiModule
  3. 3. Executable:c:phpphp-cgi.exe
  4. 4. Name:PHP via FastCGI</li></ul>Click on the OK button to commit the settings, then Yes on the confirmation dialog box that follows.<br />Using Modu REF _Internet_Information_Services__IIS_ h * MERGEFORMAT REF _Internet_Information_Services__IIS_ h * MERGEFORMAT REF _Internet_Information_Services__IIS_ h * MERGEFORMAT les to Control and Customize IIS<br />Modules in IIS 7.0 control and customize its functionality, resulting in greater flexibility and efficiency of the server platform. The core Web server in IIS 7.0 has been re-engineered and replaced by more than 40 separate feature modules that can be installed either during setup or later, depending on Web site and application requirements. This modular architecture reduces the attack surface of IIS and any unnecessary administrative overhead by eliminating the amount of unused code loaded into memory.<br />By default, these modules are Dynamic Link Library files stored in the %WINDIR%System32inetsrv folder. They can be classified into two types, as follows.<br />Native: A native module has unrestricted access to any resource available to the server worker process, just like an ISAPI filter or extension in previous versions. <br />Managed: Managed modules can be configured separately for each site or application. They are loaded for processing only when required by the particular site or application.<br />Typically, modules providing basic IIS functionality are installed during setup. Thereafter, modules can be installed using one of the following methods:<br />Manually editing the new IIS 7.0 configuration store, APPLICATIONHOST.CONFIG. This method is similar to configuration in Apache.<br />Using the IIS 7.0 Manager administration tool.<br />Using the IIS 7.0 APPCMD.EXE command line tool.<br />The modular architecture of IIS 7.0 makes it easy to add, remove, and replace built-in modules, and to add third-party modules. IIS 7.0 also allows for scripting of module management to create programmatic changes to control management or configuration, and to customize the API.<br />Adding and Configuring Modules using IIS Manager<br />In IIS 7.0, only the modules needed to run IIS as a static content server are installed by default. In past IIS versions, all functionality was installed by default, which allowed the IT administrator to start from the most secure base. With IIS 7.0, modules are added only as needed by the applications and services hosted on the Web server, allowing technical professionals to easily add new functionality to their servers. <br />IIS 7.0 facilitates the writing of additional modules to execute tasks such as restricting Web access, adding functionality, or allowing administration of a subset of Web sites. The modular aspect of IIS 7.0 provides IT professionals with increased control over deployment and configuration and reduces the surface of attack.<br />Site administrators can easily add, remove, and replace IIS modules from the IIS server process using the IIS Manager console.<br />Adding New Modules<br />To add a module in IIS 7.0, open IIS Manager. In the Connections pane, select the site to receive the module, then drill down and highlight the system_web folder. In the center Workspace pane, click on the Modules icon to open a dialog box that lists all available modules.<br />In the Actions pane, click on the Add Managed Module link. A dialog box displays a list of available modules. In the Name field, type the name of the module being added and then choose the module Type from the drop-down menu. Select a check box next to Invoke only for requests to ASP.NET applications or managed handlers. Click OK to add the module.<br />Generally, Apache and IIS modules have similar functions. The following sections describe the available IIS modules.<br />HTTP Modules <br />Several IIS 7.0 modules perform tasks specific to Hypertext Transfer Protocol (HTTP) in the request-processing pipeline. These include modules to respond to information and inquiries sent in client headers, to return HTTP errors, to redirect requests, and more. <br />Apache moduleIIS equivalentDescriptionResourceCore feature: ErrorDocument DirectiveCustomErrorModuleSends default and configured HTTP error messages when an error status code is set on a response.InetsrvCusterr.dllmod_aliasHttpRedirectionModuleSupports configurable redirection for HTTP requests.InetsrvRedirect.dllmod_headersProtocolSupportModulePerforms protocol-related actions, such as setting response and redirecting headers based on the configuration.InetsrvProtsup.dll<br />Security Modules<br />Several IIS 7.0 modules perform security tasks in the request-processing pipeline. In addition, separate modules exist for each of the authentication schemes, enabling the selection of modules for the types of authentication desired on the server. Other modules perform URL authorization and filter requests. <br />Apache moduleIIS equivalentDescriptionResourcemod_auth_anonAnonymousAuthentica- tionModulePerforms Anonymous authentication when no other authentication method succeeds.InetsrvAuthanon.dllmod_authBasicAuthentication- ModulePerforms Basic authentication.InetsrvAuthbas.dll CertificateMapping- AuthenticationModulePerforms Certificate Mapping authentication using Active Directory.InetsrvAuthcert.dllmod_auth_digestDigestAuthentication-ModulePerforms Digest authentication.InetsrvAuthmd5.dllNo equivalentIISCertificateMapping- AuthenticationModulePerforms Certificate Mapping authentication using IIS certificate configuration.InetsrvAuthmap.dllPartially available as a core function of ApacheRequestFilteringModulePerforms URLScan tasks such as configuring allowed verbs and file extensions, setting limits, and scanning for bad character sequences.InetsrvModrqflt.dllmod_authUrlAuthorizationModulePerforms URL authorization.InetsrvUrlauthz.dllNot supportedWindowsAuthentication- ModulePerforms NTLM integrated authentication.InetsrvAuthsspi.dllmod_accessIpRestrictionModuleRestricts IPv4 addresses listed in the ipSecurity list in configuration.Inetsrviprestr.dll<br />Content Modules<br />Several IIS 7.0 modules perform tasks related to content in the request-processing pipeline. Content modules process requests for static files, return a default page when a client fails to specify a resource in a request, list the contents of a directory, and more. <br />Apache moduleIIS equivalentDescriptionResourcemod_cgiCgiModuleExecutes Common Gateway Interface (CGI) processes to build response output.InetsrvCgi.dllmod_dirDefaultDocumentModuleAttempts to return a default document for requests made to the parent directory.InetsrvDefdoc.dllmod_autoindexDirectoryListingModuleLists the contents of a directory.Inetsrvdirlist.dllThird partyIsapiModuleHosts ISAPI extension DLLs.InetsrvIsapi.dllNot supportedIsapiFilterModuleSupports ISAPI filter DLLs.InetsrvFilter.dllCore feature: Options directiveServerSideIncludeModuleProcesses server-side includes code.InetsrvIis_ssi.dllCore feature: EnableSendfile directoveStaticFileModuleServes static files.InetsrvStatic.dllmod_fcgidFastCgiModuleSupports FastCGI, a high-performance alternative to CGI.Inetsrviisfcgi.dll<br />Compression Modules<br />Two IIS 7.0 modules perform compression in the request-processing pipeline. <br />Apache moduleIIS equivalentDescriptionResourcemod_gzipDynamicCompression- ModuleCompresses responses and applies GZIP compression transfer coding to responses.InetsrvCompdyn.dllmod_gzipStaticCompression- ModulePerforms precompression of static content.InetsrvCompstat.dll<br />Caching Modules<br />Several IIS 7.0 modules perform tasks related to caching in the request-processing pipeline. Caching improves the performance of Web sites and Web applications by storing processed information such as Web pages in memory on the server, and then reusing that information in subsequent requests for the same resource. <br />Apache moduleIIS equivalentDescriptionResourcemod_cache and supporting modulesFileCacheModuleProvides user mode caching for files and file handles.InetsrvCachfile.dllmod_cache and supporting modulesHTTPCacheModuleProvides kernel mode and user mode caching in HTTP.sys.InetsrvCachhttp.dllmod_cache and supporting modulesTokenCacheModuleProvides user mode caching of user name and token pairs for modules that produce Windows user principals.InetsrvCachtokn.dllmod_cache and supporting modulesUriCacheModuleProvides user mode caching of URL info.InetsrvCachuri.dll<br />Logging and Diagnostics Modules<br />Several IIS 7.0 modules perform tasks related to logging and diagnostics in the request-processing pipeline. The logging modules support loading custom modules and passing information to HTTP.sys. The diagnostics modules follow and report events during request processing. <br />Apache moduleIIS equivalentDescriptionResourcemod_log_configCustomLoggingModuleLoads custom logging modules.InetsrvLogcust.dllNot supportedFailedRequests- TracingModuleSupports the Failed Request Tracing feature.InetsrvIisfreb.dllmod_log_configHttpLoggingModulePasses information and processing status to HTTP.sys for logging.InetsrvLoghttp.dllmod_dtraceRequestMonitorModuleTracks requests currently executing in worker processes and reports information with the Runtime Status and Control Application Programming Interface.InetsrvIisreqs.dllmod_log_configTracingModuleReports events to Microsoft Event Tracing for Windows (ETW).InetsrvIisetw.dll<br />Managed Support Modules<br />Two IIS 7.0 modules support managed integration in the IIS request-processing pipeline. <br />Apache moduleIIS equivalentDescriptionResourceNot supported ManagedEngineProvides integration of managed code modules in the IIS request-processing pipeline.Microsoft.NETFrameworkv2.0.50727webengine.dllThird partyConfigurationValidationModuleValidates configuration issues, such as when an application is running in Integrated mode but has handlers or modules declared in the system.web section.Inetsrvvalidcfg.dll<br />Managed Modules<br />In addition to native modules, IIS 7.0 enables the use of managed code modules to extend IIS functionality. Some of the managed modules, such as UrlAuthorization, have a native module counterpart that provides a native alternative to the managed module.<br />Apache moduleIIS equivalentDescriptionResourcemod_auth_anonAnonymousIdentifica- tionManages anonymous identifiers used by features supporting anonymous identification, such as ASP.NET profile.System.Web.Security.AnonymousIdentificationModulemod_authDefaultAuthenticationEnsures that an authentication object is present in the context.System.Web.Security.DefaultAuthenticationModulemod_authFileAuthorizationVerifies that a user has permission to access the requested file.System.Web.Security.FileAuthorizationModulemod_authFormsAuthenticationSupports Forms authentication.System.Web.Security.FormsAuthenticationModulemod_authOutputCacheSupports output caching.System.Web.Caching.OutputCacheModulemod_authProfileManages user profiles using ASP.NET profile, which stores and retrieves user settings in a data source such as a database.System.Web.Profile.ProfileModuleThird partyRoleManagerManages a RolePrincipal instance for the current user.System.Web.Security.RoleManagerModulemod_perlSessionSupports maintaining session state, which enables storage of data specific to a single client within an application on the server.System.Web.SessionState.SessionStateModuleThird partyUrlAuthorizationDetermines whether the current user has access to the requested URL based on the user name or the list of roles of which the user is a member.System.Web.Security.UrlAuthorizationModulemod_rewriteUrlMappingsModuleSupports mapping a real URL to a more user-friendly URL.System.Web.UrlMappingsModuleNot supportedWindowsAuthenticationSets the identity of the user for an ASP.NET application when Windows authentication is enabled.System.Web.Security.WindowsAuthenticationModule<br />Distributed Configuration Model<br />The new configuration system in IIS 7.0 caches configuration files equivalent to .htaccess files in Apache, consuming significantly less memory. In addition, there are various ways to configure IIS 7.0 to take advantage of either global or more granular configuration changes.<br />IIS 7.0 uses a powerful configuration scheme that provides enhanced ASP.NET integration, including shared configuration and HTTP runtime support. The XML-based configuration model uses configuration text files that hold configuration settings and that can be stored in separate XML files in a folder.<br />IIS 7.0 uses three main XML files that maintain server deployments:<br />MACHINE.CONFIG holds .NET Framework settings for the server. These settings are inherited by all other .NET Framework configuration files and can be located by default at %windir%Microsoft.netFramework <framework_version>ConfigMachine.config.<br />The APPLICATIONHOST.CONFIG file contains settings for IIS and its services. By default, it is located at %windir%System32inetsrvconfigapplicationHost.config.<br />The ROOT WEB.CONFIG file holds the global settings for ASP.NET Web applications and it is located at %windir%Microsoft.NETFramework<framework_version>ConfigRoot Web.config. This file gives each application a WEB.CONFIG file that overrides global settings. It also allows the IIS configuration settings to be stored in these web.config files, making copying applications across multiple Web servers much easier, and avoids costly and error-prone replication, manual synchronization, and additional configuration tasks.<br />Administration Using IIS 7.0<br />This section instructs Apache administrators on how to use IIS to execute management tasks that they perform on Apache.<br />Customizing Error Messages <br />For every standard HTTP error 403, 404, 504, a message is returned to the browser. Different Web servers allow administrators to return a default error message, a specific Web page, or a file as a Web page for each error. The following section describes custom error pages with Apache and IIS 7.0. <br />Apache<br />In Apache, customizing error messages is done using the .htaccess file, which allows administrators to manipulate server behavior and create custom server error messages. Examples of such errors are the " 404 Not Found" error that appears when a link is broken and the " 500 Internal Server Error" that appears when a script fails. The .htaccess file tells the server to display a special page in case of an error. <br />IIS 7.0<br />IIS 7.0 also allows administrators to return special pages in place of default pages for Web site errors. For example, instead of displaying the message, " 404 File Not Found," a message listing optional links along with the company header and an apologetic note may be displayed.<br />By default, IIS returns two types of errors when a problem occurs. The first type is the standard custom error, including a terse error description and an error code. The second type of error is a detailed error, which by default only returns requests from localhost. IIS 7.0 can be configured to return detailed errors all the time, specifically when the application needs to be run in debug mode, or to never return detailed errors and instead always return custom errors.<br />To configure custom error messages in IIS 7.0, open the IIS 7.0 Management Console, double-click the name of the Web site to launch the site management options, and scroll down to locate the “Error Page” feature under the IIS heading. Double-click on the Error Page icon or right-click and choose Open Feature.<br />Figure 6: Accessing Open Feature to Customize Error Messages<br />From the available Error Pages pane, right-click on any error entry and click either Add or Edit to add an entry to the list or to edit the selected entry, respectively.<br />Figure 7: Selecting an Error Message to Edit<br />A popup window will appear for both selections. The Edit Custom Error Page popup window allows the path of the custom error page to be edited, and the Add Custom Error Page popup window allows a new error message to be defined.<br />Figure 8: Edit Custom Error Message <br />Figure 9: Add Custom Error Message<br />To enable IIS 7.0 to return detailed error messages all the time and not just for the localhost, click on Edit Feature Settings in the left pane, change the properties in the popup window accordingly and click OK to save the changes.<br />Figure 10: Edit Error Page Settings<br />URL Rewriting<br />URL rewriting is a way to modify the appearance of a Web URL. Web application users prefer short, neat URLs instead of raw query string parameters. A concise URL is easy to remember and less time-consuming to type in. If the URL can be made to relate clearly to the content of the page, then errors are less likely to happen.<br />Example<br />The following URL has query string parameters that encode the date of the available postings that should be displayed by some blog engines:<br />http://www.somebloghost.com/Blogs/Posts.php?Year=2006&Month=12&Day=10<br />The above URL may be modified to reflect clearly what the page will display:<br />http://www.somebloghost.com/Blogs/2006/12/10/<br />Benefits<br />Rewriting URLs provides many benefits. It can improve the security of the site, minimize migration issues, and provide an extra layer of abstraction to Web applications. Other benefits of URL rewriting include:<br />Making Web site URLs more user- and search engine-friendly.<br />Preventing undesired “inline linking”.<br />Preventing the exposure of the inner workings of a Web site's address to visitors.<br />Maintaining the URLs of Web site pages even if the underlying technology used to serve them changes.<br />Apache<br />For URL rewriting, Apache comes with a well-known module called mod_rewrite. This module provides a rule-based rewriting engine to rewrite requested URLs on the fly. The mod_rewrite module is enabled in the Apache.conf file by removing the # and restarting Apache. Rewrite rules can then be defined in the .htaccess file within any particular directory.<br />IIS 7.0<br />IIS 7.0 now offers URL rewriting, one of the most hotly requested features. It is free to all IIS 7.0 users and available for download for x86 and x64 platforms from:<br />http://www.iis.net/extensions/URLRewrite<br />The following walkthrough illustrates the process of creating and testing a set of rewrite rules for the IIS 7.0 URL rewrite module.<br />Prerequisites<br />This walkthrough requires the following prerequisites:<br />IIS 7.0 with ASP.NET role service enabled.<br />URL rewrite module installed.<br />Steps<br />The following format creates a simple rewrite rule that rewrites this URL<br />http://localhost/article/342/some-article-title<br />into<br />http://localhost/article.aspx?id=342&title=some-article-title.<br />The URL Rewrite UI in IIS Manager creates a rewrite rule. To do this, follow these steps:<br />Go to IIS Manager.<br />Select Default Web Site.<br />In the Feature View, click URL Rewrite Module.<br />In the Actions pane on right-hand side, click on Add rules…<br />In the Add Rules dialog, select the Blank Rule and click OK.<br />In the URL rewrite module, a rewrite rule is defined by specifying four required pieces of information:<br />Naming a rule: In the Name text box, enter a name to uniquely identify the rule, for example: Rewrite to article.aspx.<br />Defining a pattern: In the Pattern text box, enter the following string:<br />^article/([0-9]+)/([_0-9a-z-]+)<br />Defining an action: Since the rule to be created is supposed to rewrite the URL, choose the Rewrite action type listed in the Action group box. In the Rewrite URL: text box, enter the following string:<br />article.aspx?id={R:1}&title={R:2}<br />Leave default values for all other settings. The Edit Rule property page should look like the following screenshot:<br />Figure 11: Edit Rule Property Page<br />Save the rule by clicking on the Apply action on the right-hand side.<br />Testing the Rule<br />To test that the rule correctly rewrites URLs, open a Web browser and request the following URL:<br />http://localhost/article/234/some-title<br />The rewrite rule on the Web server should change the original URL to article.aspx and should pass “234” and “some-title” as values for query string parameters.<br />The detailed procedure for setting up the URL rewrites on IIS 7.0 can be viewed at<br />http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/.<br />Web Caching<br />Web caching is the temporary storage of Web objects such as HTML documents for later retrieval. There are three significant advantages to Web caching: reduced bandwidth consumption as fewer requests and responses need to go over the network, reduced server load as a server has fewer requests to handle, and reduced latency since responses for cached requests are available immediately and are closer to the client being served. Together, these advantages make the Web less expensive and improve performance.<br />Methods<br />Caching can be performed by the client application and is built into most Web browsers. A number of products extend or replace built-in caches with systems containing larger storage, more features, or better performance.<br />Caching can also be implemented between the client and the server as part of a proxy. Proxy caches are often located near network gateways to reduce the bandwidth required over expensive dedicated Internet connections.<br />Finally, caches can be placed directly in front of a particular server to reduce the number of requests that the server must handle.<br />Caching in Apache<br />In Apache, caching normally relies on three modules:<br />mod_cache<br />mod_disk_cache<br />mod_mem_cache<br />Running the httpd binary with the -M flag can determine the modules that are loaded:<br />$ /usr/local/apache2/bin/httpd –M<br />The commands to configure caching must be defined in the main server configuration file(s), not in .htaccess files. Caching techniques will not work without server administrator access.<br />Finally, the modules and techniques defined in this section are available in Apache 2.0 and 2.2, but are not available in Apache 1.3.<br />Example<br />CacheEnable disk /<br />CacheRoot /var/www/cache<br />CacheDefaultExpire 3600<br />CacheMinExpire 3600<br />The above configuration caches all of the content on the Web site, and the cache will persist for at least an hour regardless of its “freshness.”<br />This technique is most appropriate for dynamic content that should be cached and served as static content. This is how Apache forces the caching of dynamic content for a certain period that would otherwise be served dynamically each time before hitting the database again.<br />The time specified is in seconds, forcing at least an hour of caching regardless of the " freshness" of the content.<br />Caching in IIS 7.0<br />The IIS 7.0 output cache is a new feature that makes it possible to cache entire responses in memory, even from dynamic content. Unlike existing caches in IIS 6.0, IIS 7.0 has a “smart” cache, which lets site owners and developers configure the output cache to allow caching of separate copies of responses based on query string values.<br />The output cache is also integrated with the HTTP.sys kernel cache that helps with fast performance. Kernel caching is unlocked by default. Developers can take advantage of this feature by configuring caching profiles within their applications. A command line tool can be executed to show the content in the HTTP.sys cache.<br />In IIS 7.0, a rule based on response headers may be configured to cache different versions of content in a site or application.<br />Configuring the Output Cache Rule Using Headers<br />Administrators can perform this procedure through the user interface by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.<br />Open IIS Manager and navigate to the level to be managed.<br />In Features View, double-click Output Caching.<br />Figure 12: Output Caching Feature<br />Click Add in the Actions pane.<br />Figure 13: Create a Caching Rule<br />In the Add Cache Rule dialog box, enter the file name extension in the File Name Extension box for the cache rule being created, such as .aspx.<br />Figure 14: Add a Cache Rule<br />Check the User-mode caching box to enable output caching, and select one of the following options:<br />Using file change notification: to remove an item from the cache when it is updated.<br />At time intervals (hh:mm:ss): to remove an item from the cache after a certain time elapses.<br />Prevent all caching: to prevent all caching of the designated file type.<br />Click Advanced.<br />In the Advanced Output Cache Rule Settings dialog box, click Headers under Cache different versions of a file based on.<br />Figure 15: Advanced Output Cache Rule Settings<br />Type a response header, such as Accept-Language or Accept-Charset, in the Headers box and then click OK.<br />Web Output Compression<br />Although Web page compression is not a new technology, it has gained recent recognition in the minds of IT administrators and managers because of the almost-immediate ROI that it generates. <br />Apache<br />The Web output compression solution available in Apache is mod_gzip, one of the many additional modules available for the platform. Many administrators use it in designing a high-performance Web server. With this module, configured file types are compressed using GZIP encoding after processing by Apache's other modules and before being sent to the client.<br />The idea behind GZIP-encoding is that, for files to be transmitted to a Web client, a compressed version of the data rather than the raw file is sent.<br />When a request is received from a client, Apache determines if mod_gzip should be invoked by noting whether the " Accept-Encoding" HTTP request header was sent. If the client sends the header, mod_gzip compresses the output of all configured file types when they are sent to the client.<br />Accept-encoding: gzip<br />This client header announces to Apache that the client will understand files that have been GZIP-encoded. mod_gzip then processes the outgoing content and includes the following server response headers.<br />Content-Type: text/html<br />Content-Encoding: gzip<br />These server response headers announce that the content returned from the server is GZIP encoded, but that expanded content should be treated as a standard HTML file.<br />IIS 7.0<br />IIS 7 has improved and simplified support for GZIP encoding enabled out-of-the-box execution of Web compression.<br />In IIS 7.0, compression is configured in the ApplicationHost.config file at C:WindowsSystem32inetsrvconfigapplicationhost.config. The following is a simple httpCompression section: <br /><httpCompression directory=" %SystemDrive%inetpub empIIS Temporary Compressed Files" ><br /> <scheme name=" gzip" dll=" %Windir%system32inetsrvgzip.dll" /><br /> <dynamicTypes><br /> <add mimeType=" text/*" enabled=" true" /><br /> <add mimeType=" message/*" enabled=" true" /><br /> <add mimeType=" application/x-javascript" enabled=" true" /><br /> <add mimeType=" */*" enabled=" false" /><br /> </dynamicTypes><br /> <staticTypes><br /> <add mimeType=" text/*" enabled=" true" /><br /> <add mimeType=" message/*" enabled=" true" /><br /> <add mimeType=" application/x-javascript" enabled=" true" /><br /> <add mimeType=" */*" enabled=" false" /><br /> </staticTypes><br /></httpCompression><br />and<br /><urlCompression doStaticCompression=" true" doDynamicCompression=" false" /><br />The compression module gives IIS the ability to serve compressed responses to compression-enabled clients. Clients that can accept compressed responses send an Accept-Encoding header indicating the compression schemes that they can handle. If IIS can compress the response using one of these compression schemes, it then sends a compressed response with a Content-Encoding response header indicating the scheme used to compress the response.<br />The following is an example of a request response:<br />REQUEST: **************<br />GET /static/index.htm HTTP/1.1 <br />Accept-Encoding: gzip, deflate <br />Host: localhost <br />Accept: */* <br /> <br />RESPONSE: **************<br />HTTP/1.1 200 OK <br />Content-Type: text/html <br />Content-Encoding: gzip <br />Last-Modified: Tue, 28 Mar 2006 03:44:06 GMT <br />Accept-Ranges: bytes <br />ETag: " 087e0dc1952c61:0" <br />Vary: Accept-Encoding <br />Server: Microsoft-IIS/7.0 <br />X-Powered-By: ASP.NET <br />Date: Tue, 13 Jun 2006 02:23:41 GMT <br />Content-Length: 438 <br />In IIS 7.0, static compression is ON by default. Dynamic compression is OFF by default and can be turned ON for all content by running:<br />appcmd set config -section:urlCompression /doDynamicCompression:true<br />As static compression is enabled by default and compression happens on the main thread, compression may be shut off and resumed on the fly depending on CPU load. Four properties are available to the system.webServer/httpCompression section to control this behavior:<br />staticCompressionDisableCpuUsage – disables compression when average CPU usage over a period is above this number.<br />staticCompressionEnableCpuUsage – enables compression if average CPU usage over a period falls below this number.<br />dynamicCompressionDisableCpuUsage – disables dynamic compression depending on CPU load.<br />dynamicCompressionEnableCpuUsage – enables dynamic compression depending on CPU load.<br />The average CPU utilization calculation is done every 30 seconds.<br />In IIS 7.0, compression can be enabled and disabled depending on the content type of the response. Just one entry in the config is sufficient to enable static or dynamic compression for text/html responses. Administrators are not required to pick up all extensions that return text/html responses.<br />While configuring these mimeTypes under httpCompression section, administrators can use * as a wildcard. <br />If response type is text/html, IIS 7.0 looks for an entry for text/html and if found, uses the corresponding enabled value. <br />If text/html is not found, IIS 7.0 looks for text/* or */html. <br />If both are present, IIS 7.0 picks the one that comes first and uses that enabled property value. <br />If none of the above is found, IIS 7.0 looks for */* and uses the corresponding enabled value. <br />To enable compression for all content types, add an entry under the httpCompression section in applicationHost.config as follows:<br /> <staticTypes> <add mimeType=" */*" enabled=" true" /> </staticTypes><br />Diagnostics and Troubleshooting<br />To effectively manage a Web server, it is necessary to get feedback on the activity and performance of the server and on any problems that may be occurring. This section instructs Apache administrators on how to execute on IIS the diagnostics and troubleshooting tasks that they perform on Apache.<br />Apache<br />The Apache HTTP Server provides comprehensive and flexible logging capabilities, which are briefly described here.<br />Error logs<br />The server error log, whose name and location is set by the ErrorLog directive, is the most important log file. This is where Apache httpd sends diagnostic information and records any errors that it encounters in processing requests. It is the first place to look when a problem occurs with starting or operating the server, since it often contains details of what went wrong and how to fix it.<br />A wide variety of different messages can appear in the error log. The error log also contains debugging output from CGI scripts. Any information written to stderr by a CGI script is copied directly to the error log.<br />In Apache, customizing the error log by adding or removing information is not possible. However, error log entries dealing with particular requests have corresponding entries in the access log. Customizing the access log to provide more information is also possible.<br />Access logs<br />In Apache, the server access log records all requests processed by the server. The CustomLog directive controls the location and content of the access log. The LogFormat directive can be used to simplify the selection of the contents of the logs. Various versions of Apache httpd use different modules and directives to control access logging, including mod_log_config, mod_log_referer, mod_log_agent, and the TransferLog directive.<br />Script logs<br />To aid in debugging, the ScriptLog directive allows you to record the input to and output from CGI scripts. This should only be used during testing and not for live servers.<br />Rewrite logs<br />When using the powerful and complex features of mod_rewrite, it is almost always necessary to use the RewriteLog to help in debugging. This log file produces a detailed analysis of how the rewriting engine transforms requests. The RewriteLogLevel directive controls the level of detail.<br />IIS 7.0<br />IIS 7.0 includes major improvements that aid in diagnostics and troubleshooting to help developers and administrators more easily work with errant Web sites and applications. The diagnostics and troubleshooting changes in IIS 7.0 allow a developer or an administrator to see, in real time, requests running on the server. IIS 7.0 also collects and exposes detailed diagnostic events to aid in troubleshooting problematic servers and applications. Some of the techniques in IIS 7.0 make troubleshooting practically effortless. <br />The following are improvements in diagnostic and troubleshooting tools in IIS 7.0:<br />Ability to see all requests currently running on the server.<br />Detailed local server error logs.<br />Detailed trace log makes it possible to track problem issues and obtain detailed information about trace events.<br />New Runtime State and Control API (RSCA) provides real-time state information about application pools, worker processes, sites, application domains, and even running requests, providing real-time state information through a native Component Object Model (COM) API and appcmd.exe.<br />IIS 7.0 can be configured to automatically capture full trace logs.<br />IIS 7.0 contains tools that let IT staff find problems and troubleshoot in IIS Manager.<br />Runtime Status and Control (RSCA)<br />The Runtime Status and Control (RSCA) API is a new feature in IIS 7.0 that provides the ability to obtain run-time status and to control the state of every aspect of a Web server, including application pools, application domains, Web sites, worker processes, and virtual directories. RSCA is designed to provide a consistent API for controlling run-time state across all server objects. Using RSCA, technical staff can develop their own infrastructure to monitor and control the state of Web sites by accessing the RSCA object hierarchy that maps directly to the worker processes in application pools. The API itself is wrapped and exposed through the new IIS WMI provider, appcmd.exe, and IIS Manager.<br />Benefits of RSCA<br />RSCA provides tools that let administrators query detailed information, such as looking into an application pool and seeing all currently running requests, and then accessing detailed information about each request. Because RSCA is geared toward developers, it takes some of the burden off the hosting provider by giving developers a tool that allows them to find detailed explanations if something goes wrong during the execution of their code. They can also start and stop sites, as well as recycle application pools. RSCA is also handy for administrators in hosting environments because they can use the appcmd.exe command-line tool or IIS Manager to resolve a hanging request problem and determine which script is consuming CPUs resources.<br />Detailed Error Information<br />IIS 7.0 displays extensive error information, which helps diagnose and troubleshoot problems. What makes error information displayed in IIS 7.0 unique is the amount of detail provided, and that IIS Manager provides information about the possible causes of the error as well as tips on ways to fix the problem. This saves time in locating the source of errors and quickly fixing them. <br />The following figure provides an example of an error message in IIS 7.0. The detailed server errors appear only on the local server and are not displayed to end-users on the site.<br />Figure 16: IIS 7.0 Error Message Sample<br />Customizing Error Messages and Failed Request Tracing<br />IIS 7.0 also allows administrators to configure the HTTP error message responses displayed to control the information provided during an error condition. In the IIS section of the Features View, click the Error Pages icon to display the Error Messages dialog box, as shown in the next figure.<br />Figure 17: Setting Error Message Responses<br />Use this feature to configure HTTP error responses. The error responses can be custom error pages or detailed error messages that contain troubleshooting information. <br />Information that can be set includes:<br />The ability to insert content from a static file into the error response.<br />Whether to execute a URL on the site.<br />Whether to respond with a 302 redirect.<br />Benefits of Error Reporting in IIS 7.0<br />IIS 7.0 provides extensive reporting for error conditions and displays detailed information to help administrators diagnose and troubleshoot problems quickly. In addition, HTTP error message responses can be customized to even better suit their needs. Diagnostics and error reporting in IIS 7.0 help developers and administrators quickly locate problems and fix them. Administrators can view error and diagnostic messages in real-time without needing to look through various logs to determine the source of a problem, saving both time and expenses.<br />Failed Request Tracing<br />The new Failed Request Tracing technology allows administrators to define error conditions that, when triggered, write detailed error information to log files. Failed Request Tracing is particularly useful in tracing intermittent or complex problems. In IIS 7.0, it is even possible to add tracing to custom modules. Error conditions can range from “slow” or “hung” requests to the familiar status codes that IIS sends back during error conditions, such as “Server 500 Error.” When configured, if IIS 7.0 detects one of these error conditions, it automatically logs detailed trace events of everything that happened during the request that led up to the error.<br />How Failed Request Tracing Works<br />The tracing infrastructure in IIS 7.0 is very flexible. Since both trace event providers and trace event consumers are simply modules, selecting which modules to use is easy. For example, the technical professional can use Event Tracing for Windows (ETW) or Failed Request Tracing, the automatic fail request tracing infrastructure in IIS 7.0. In addition to choosing one of these existing modules, creating both consumer and provider modules and plugging them into the tracing infrastructure is easy. This allows technical staff to use their own providers and consumers in any place that normally uses built-in providers and consumers. <br />Example: The IIS Manager console is used to define a trace condition, such as a " 404 File Not Found" error that may occur as a result of a request. This request is written to the Trace Configuration file. When the Web server processes a request, the pipeline modules read the trace configuration information for that provider. Then, when an event that matches the tracing configuration occurs, such as the " 404 File Not Found" error defined earlier, the pipeline module raises a trace event. The trace event is then delivered back to the source consumer module that registered the trace event. That consumer module is responsible for doing something with that event, such as writing it to a log file.<br />To set up a failed request tracing rule in IIS 7.0, do the following:<br />In the IIS section of the Features View, click the Failed Request Tracing Rules icon. The Define Trace Conditions dialog box displays, as shown in the next figure.<br />In the Add Failed Request Tracing Rule dialog box, click an item in the list to indicate what should be traced. Valid selections are: all content, ASP.NET (*.aspx), ASP (*.asp) or Custom (where a name such as tr*.aspx can be entered). Click Next to display the next dialog box.<br />Figure 18: Setting a Failed Request Trace Rule<br />In the Define Trace Conditions dialog box, indicate the conditions under which a request should be traced. A status code, time taken, and severity may be entered. When the trace information has been set, click Finish to complete the trace rule. Whenever a failed request meets the criteria established, it will be traced.<br />Benefits of Using Failed Request Tracing <br />Large datacenters and hosting providers appreciate the enhanced productivity leveraged by the new Failed Request Tracing capabilities of IIS 7.0. It is no longer necessary for administrators to try to reproduce problems that occur intermittently or only under certain circumstances. Once Failed Request Tracing is configured, it automatically tracks the defined condition. Furthermore, it is not necessary to turn Failed Request Tracing on for every Web site and every URL on a server. Moreover, administrators no longer need to spend time attempting to reproduce complex or intermittent problems. Not only does failed request tracing reduce the amount of tracing information that can be logged, it also ensures that this powerful feature has as little performance impact as possible on the server.<br />With the minimal impact on performance and the significant gain in information retrieved by Failed Request Trace, it is feasible to turn it on for newly deployed sites or as a means of verifying that sites are running error free. Using Failed Request Tracing in IIS 7.0 helps pinpoint the cause of failures to make resolving the issue quicker and easier. <br />Securing the Web Server<br />Apache<br />Apache administrators often use the following steps to secure their configurations:<br />Apply Security Patches.<br />Hide the Apache version number and other sensitive information.<br />ServerSignature Off<br />ServerTokens Prod<br />Make sure Apache is running under its own user account and group.<br />User apache<br />Group apache<br />Ensure that files outside the Web root are not served.<br /><Directory /><br /> Order Deny,Allow<br /> Deny from all<br /> Options None<br /> AllowOverride None<br /></Directory><br /><Directory /web><br /> Order Allow,Deny<br /> Allow from all<br /></Directory><br />Turn off directory browsing.<br />Options -Indexes<br />Turn off CGI execution.<br />Options -ExecCGI<br />Run mod_security, a module written to apply several different security configurations:<br />Filtering (Simple and Regular Expression based)<br />Encoding Validation (URL and Unicode)<br />Auditing<br />Upload memory limits<br />Server identity masking, etc.<br />IIS 7.0<br />Microsoft offers a free tool called UrlScan that does all of the tasks related to securing the Web server. On IIS 5.1 Web servers, UrlScan runs in conjunction with IISLockDown, a standard security package that should be installed on every IIS 5.1 server and that includes simple fixes with significant benefits. On IIS 7.0, the built-in Request Filtering feature includes functionality equivalent to UrlScan 2.5.<br />UrlScan v3.1 is a security tool that restricts the types of HTTP requests processed by IIS and provides an update to the Request Filtering module in IIS 7.0. By blocking specific HTTP requests, UrlScan helps prevent potentially harmful requests from being processed by Web applications on the server. It is a one-stop shop to cater to almost all security needs.<br />Along with UrlScan, a powerful module called Request Filtering is integrated into IIS 7.0. In the Request Filtering module, the IIS 7.0 team incorporated all the core features of UrlScan and added an additional feature called Hidden Segments. Details and a complete options set for the Request Filtering module can be found at <br />http://learn.iis.net/page.aspx/143/how-to-use-request-filtering/.<br />The Dynamic IP Restrictions for IIS 7.0 is a module that provides protection against denial of service and brute force attacks on Web servers and Web sites. Such protection is provided by temporarily blocking IP addresses of the HTTP clients that make unusually high number of concurrent requests or that make large number of requests over a short period. Detailed instructions on installation and usage of this module can be found at<br />http://learn.iis.net/page.aspx/548/using-dynamic-ip-restrictions/.<br />Conclusion<br />The rich set of functionalities in IIS 7.0, in addition to the parity in features compared with Apache, makes migrating Web applications from Apache to IIS 7.0 a worthwhile investment.<br />IIS 7.0 provides easy-to-use, flexible tools for developers, administrators, and Web hosting companies that simplify management of Web servers. For instance, a flexible extensibility model and powerful diagnostic tools allow site administrators to proactively monitor the health of Web sites, while the possibility of deploying applications using XCopy simplifies the administration of Web farms. The modular design of IIS 7.0 allows for functionality to be independently installed to reduce the attack surface of the server and to eliminate unnecessary administrative overhead. IIS 7.0 works with existing tools and scripts, and its new management and diagnostic features free up IT resources for other business critical tasks. New rich tracing and troubleshooting capabilities help solve problems more efficiently, reducing downtime and the time needed to diagnose the source of a problem.<br />In addition, administrators can decrease their workload and administrative costs by delegating the administration of IIS 7.0 to customers. This allows , for example, datacenters to manage their own content. <br />IIS 7.0, with features equivalent to that of Apache and enhanced functionality over IIS 6.0, creates significant reductions in the total cost of ownership of Web infrastructures for organizations.<br />IIS 7.0 Resources<br />Technical Communities, Webcasts, Blogs, Chat and User Groups<br />http://www.microsoft.com/communities/default.mspx <br />Microsoft Learning and Certification<br />http://www.microsoft.com/learning/default.mspx <br />Microsoft Developer Network (MSDN) & TechNet<br />http://microsoft.com/msdn <br />http://microsoft.com/technet<br />Trial Software and Virtual Labs<br />http://www.microsoft.com/technet/downloads/trials/default.mspx <br />IIS.NET Walkthroughs, Forums, Blogs and More<br /> HYPERLINK " http://www.iis.net/" http://www.iis.net<br />http://blogs.iis.net<br />http://forums.iis.net <br /> <br />The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.<br />This white paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.<br />Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in, or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.<br />Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.<br />© 2007 Microsoft Corporation. All rights reserved.<br />

×