Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 30 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
30
Dung lượng
834,18 KB
Nội dung
Figure 24-4 Viewing the SquirrelMail login screen. Login using a user account you know has email. The user’s home Squirrel- Mail page should resemble Figure 24-5. If your IMAP server does not reside on the same system and the Web server hosting SquirrelMail, edit SquirrelMail’s configuration file, /usr/share /squirrelmail/config/config.php, and modify the line that begins with $imapServerAddress (near line 29). By default, it reads $imapServerAddress = ‘localhost’; Figure 24-5 Viewing a user’s SquirrelMail home page. 564 Chapter 24 31_599496 ch24.qxd 8/30/05 7:30 PM Page 564 Change ‘localhost’ to reflect the name of the IMAP server. For example, if the IMAP server is named imap.example.com, the modified line should read: $imapServerAddress = ‘imap.example.com’; Reload Apache’s configuration to make the change take effect: # service httpd reload Reconfiguring SquirrelMail SquirrelMail provides an alternate (and perhaps preferable) method for con- figuring its behavior — a Perl-based configuration script named /usr/share /squirrelmail/config/config/conf.pl. The configuration script allows you to reconfigure SquirrelMail’s behavior and default settings. It is a com- mand line-based script (no pretty GUI), but it is easy to use and spares you having to dig around in the bowels of SquirrelMail’s PHP code. To start the configuration tool, execute the script: # /usr/share/squirrelmail/config/conf.pl The resulting screen should resemble Figure 24-6. TIP If you can’t see what you’re typing when you first start the SquirrelMail configuration tool, type c or C and press Enter to turn off the color display. Figure 24-6 Viewing the SquirrelMail configuration tool’s main menu. Providing Web Services 565 31_599496 ch24.qxd 8/30/05 7:30 PM Page 565 The key groups of settings you might want to change are the Organization Preferences, which enable you to modify SquirrelMail’s overall appearance; Server Settings, which is where you set the IMAP server name and the default domain name to use; and Folder Defaults, which define the names, locations, and behavior of the standard IMAP mail folders. To select a menu item, type the number or letter next to the item you want to change and press Enter. So, to change Server Settings, type 2 and press Enter. To change the IMAP server SquirrelMail uses, type a or A, press Enter, and then type 4 and press Enter. At the prompt (see Figure 24-7), type the name of the IMAP server you want to use and then press Enter. At (almost) any time, you can type s or S and press Enter (on most screens) to save your changes immediately or type r or R and press Enter to return to the main menu. If you prefer, you can make all of your changes and then type q or Q to exit, at which point the configuration tool prompts you to save you changes. If you don’t save your changes at this point, any changes that have not already been saved will be discarded. Many of the settings you make using SquirrelMail’s configuration tool are global and cannot be changed. The color scheme, however, what SquirrelMail calls a theme, and the default stylesheet (as defined by a CSS file) can be set globally but overridden on a per-user basis. If you make any significant configuration change, especially to server-related settings, you should view the configuration test page to make sure that the changes worked and had the desired effect. The configuration test page can sig- nificantly simplify tracking down configuration mistakes and conveniently includes a login hyperlink at the bottom. The test page is http://localhost /webmail/src/configtest.php. Figure 24-8 shows a sample page. Figure 24-7 Changing the IMAP server SquirrelMail uses. 566 Chapter 24 31_599496 ch24.qxd 8/30/05 7:30 PM Page 566 Figure 24-8 Testing SquirrelMail configuration changes. SquirrelMail’s interface provides all the features you would expect in a browser-based email client and should keep your mobile users happy. If you need more information about SquirrelMail, visit its project page on the Inter- net, www.squirrelmail.org. Configuring an RSS Feed What’s an RSS feed? RSS is an acronym for Really Simply Syndication, Rich Site Summary, or RDF Site Summary, depending on which version of the RSS spec- ification you follow. Regardless of the version you use, RSS defines and imple- ments an XML format for distributing news headlines over the Web, a process known as syndication. To express it more simply and generally, RSS makes it possible to distribute a variety of summary information across the Web in a news-headline style format. The headline information includes a URL that links to more information. That URL, naturally, brings people to your Web site. By way of example, Figure 24-9 shows the BBC’s front page RSS news. Providing Web Services 567 31_599496 ch24.qxd 8/30/05 7:30 PM Page 567 Figure 24-9 Viewing one of the BBC’s RSS feeds. The canonical use of RSS is to provide news headlines in a compact format. Most major news sites provide this type of summary information. Some open- source software projects use RSS to inform subscribers of significant events occurring in the project, such as releases, updates, and meetings. Popular blog sites use RSS to notify people of the latest blog entries. If you or your users have any sort of activity to publicize or frequently updated information to dis- tribute, one way to do so is to provide an RSS feed on your Web site. This sec- tion shows you how to set up a simple, no-frills RSS feed that follows the 0.91 RSS specification. (See the sidebar “Sorting out RSS Versions” for a discussion of the competing RSS versions.) NOTE For more information about RSS and RDF, see the home pages for the original RSS specification, http://purl.org/rss/ and the W3C RDF activity pages at http://www.w3.org/RDF/. If you’re providing an RSS feed, you might be curious how your Web site visitors might use it. Many people track news and other RSS feeds using an RSS aggregator. An aggregator is an application or browser extension that col- lects (or aggregates) RSS feeds from a list of sites that you specify and presents all of them in a single interface. Most aggregators can understand both plain vanilla RSS feeds and the more feature-rich Atom feeds. One of our favorite feed aggregators is the Firefox extension called Sage (see Figure 24-10). 568 Chapter 24 31_599496 ch24.qxd 8/30/05 7:30 PM Page 568 Figure 24-10 Using the Sage RSS aggregator in Firefox. Providing Web Services 569 SORTING OUT RSS VERSIONS There are different versions of the RSS specifications, at this point in time, three versions, 0.9x, 1.0, and 2.0. The original version, RSS 0.91, was designed by Netscape and UserLand Software’s Dave Winer. The current iteration of the 0.9x specification is 0.94. The 0.9x spec is the simplest to understand and the easiest to use, so it is generally referred to as Really Simple Syndication. Dave Winer maintains control of this version of the RSS specification. RSS 1.0, referred to as RDF Site Summary, where RDF stands for Resource Description Framework, is a version of RSS promoted by the W3C. It is not necessarily an improvement over RSS 0.9x. Rather, it is a version of RSS that can be parsed by any reader that understands RDF. Accordingly, any RDF-capable reader can handle an RSS 1.0 feed without having to understand anything about RSS itself. Unfortunately, proponents of the simpler 0.9x specification and the more standardized 1.0 specification were unable to come to a compromise, which resulted in the 1.0 branch morphing into a version known as Atom. Meanwhile, in reaction to the emergence of Atom, proponents of the 0.9x branch started working on RSS 2.0. RSS 2.0 is the successor to RSS 0.9x. Like 0.9x, RSS 2.0 development is led by Dave Winer but, partially in response to criticism that he owned the copyright on RSS 0.9x, Winer donated copyright on 2.0 to Harvard University and removed himself as the final judge of RSS 2.0 extensions or usage. As the matter stands, then, you can write Atom-compliant RSS feeds or 0.9x/2.0-compliant feeds. Choosing which one is likely to come down to a matter of what your users want and whether you prefer the simplicity of the 0.9x/2.0 branch or the alleged “standards compliance” of the Atom branch. 31_599496 ch24.qxd 8/30/05 7:30 PM Page 569 On the right side of the browser screen, Sage shows article summaries. You can click these summaries to view the entire article. Notice that the left side of the screen contains the Sage sidebar. The sidebar is always present (unless you close it), which makes it easy to jump to the news or other RSS feed item that interests you. The upper portion of the sidebar lists each individual feed that you track. The lower portion of the Sage sidebar lists each individual feed item available from the feed that is currently selected in the upper portion of the sidebar. For example, in Figure 24-10, the selected feed is from The Register, which had 15 different feed headlines. Clicking a feed headline in the list loads it into the browser window on the right. Selecting Content for an RSS Feed What kind of content might be appropriate to include in an RSS feed? Struc- turally, any sort of list-oriented information, that is, information that can be organized into a list of hyperlinks and that contains information people will likely find useful are potential candidates for inclusion in an RSS feed. In terms of content, you might include the following types of information: ■■ News and announcements about products, events, press releases, or whitepapers ■■ If your Web site (rather, the Web site you maintain) frequently updates documents, you might consider providing an RSS feed that lists new or updated documents (or individual pages) ■■ Calendars of events, such as company appearances at trade shows, user group meetings, or listings of training sessions ■■ Listings of available jobs As a final suggestion, RSS feeds can be even more useful on a company intranet than they are on an extranet. For example, a human relations depart- ment might use an RSS feed to notify people of new or updated personnel forms. A payroll team might use an RSS feed to let people know when paychecks can be picked up or to remind employees to fill out important paperwork. Creating the Feed File Listing 24-1 shows a minimal RSS feed file. You can type this as a model for your own file, type in the listing yourself, or use the included feed.rss file from this chapter’s code directory on the CD-ROM. 570 Chapter 24 31_599496 ch24.qxd 8/30/05 7:30 PM Page 570 <?xml version=”1.0”?> <rss version=”0.91”> <channel> <title>RHLNSA3 Channel</title> <link>http://localhost/</link> <description>Updates for RHLNSA3</description> <language>en-us</language> <image> <title>RHLNSA3 Channel</title> <url>http://localhost/favicon.png</url> <link>http://localhost/rhlnsa3/</link> </image> <item> <title>RHLNSA3 News: April 5, 2005</title> <link>http://localhost/rhlnsa3/20050405.html</link> <description>RSS feeds material nearly complete!</description> </item> </channel> </rss> Listing 24-1 A bare-bones RSS feed. This file contains the key tags you need to create an RSS feed, which Table 24-2 describes. The <?xml version=”1.0”?> line is required by the XML specification, and it must be the first line in the file. Table 24-2 Minimum Required Elements in an RSS Feed TAG DESCRIPTION channel Delimits the contents of a single channel description Describes the channel or lists the headline for the syndication item image Describes an icon or image that represents the channel item Delimits a single syndication item language Informs readers of the language in which the feed is written link Contains a link to the channel home page or an individual syndication item rss Defines the content as RSS data and specifies the version (0.91) title Identifies the channel or individual syndication item Providing Web Services 571 31_599496 ch24.qxd 8/30/05 7:30 PM Page 571 Required tags are shown in boldface. As an XML file, all of the tags in an RSS file must be terminated with matching </> tags (such as <channel> </channel> and <link></link>), and the tags have to be lower case. The version attribute of the <rss> tag is required because it enables RSS readers (usually called feed aggregators) to know which version of RSS to support and how to interpret the contents of the RSS file. The meat of an RSS feed appears in <item> tags. The information in a feed item’s <title> tag serves as the headline, so it should be catchier than the ho-hum <title> shown in Listing 24-1. Each item’s <link> contains the URL of the document containing the full scoop or other content you are trying to publicize using RSS. The text in the <description> tag might be shown as text under the headline, as pop-up text that appears if a mouse cursor hov- ers over the headline link, or it might be totally ignored, depending on the RSS reader in use. Turning on an RSS Feed Naturally, Web browsers and feed aggregators need to know that your Web site has an RSS feed and where to find it. To do this, you need to add some metadata to the headers of your Web pages. Use the HTML <link> tag to do so. The following code snippet shows a template you can use for HTML pages: <link rel=”alternate” type=”appliation/rss+xml” href=”rssfile.rss” title=”descriptive text”> If your Web pages are XHTML, the <link> tag must use the implicit end tag marker, as shown in the following snippet: <link rel=”alternate” type=”appliation/rss+xml” href=”rssfile.rss” title=”descriptive text” /> Replace rssfile and descriptive text with the name of your RSS feed file and an appropriate title, respectively. For the RSS feed file shown in List- ing 24-1, and for HTML-based pages, you could use the following <link> tag: <link rel=”alternate” type=”application/rss+xml” href=”feed.rss” title=”RHLNSA3 Updates”> After you have added this text, RSS-capable applications will be aware that you provide an RSS feed. For example, if you load the page containing this text in an RSS-capable Web browser, such as Firefox, and you’ll see a small icon in the lower-right corner of the window that signals an RSS feed is available. (See Figure 24-11.) 572 Chapter 24 31_599496 ch24.qxd 8/30/05 7:30 PM Page 572 Figure 24-11 Viewing Firefox’s icon indicating a Web page has an RSS feed. Interested readers can see a slightly modified example of this feed in action at http://www.kurtwerks.com/pubs/rhlnsa3/. Creating a simple RSS feed like the one in this section is a relatively low impact activity. It would quickly grow to become a labor-intensive undertak- ing if you had to do it manually. Fortunately, there are a variety of tools that automate the creation of RSS feeds, and some content management systems even include tools to create RSS feeds automatically. Other tools exist that you can use to validate your RSS feeds for correct format. This section ends with a list of RSS creation and validation tools that you might find useful: ■■ Online RSS 0.9x Validator (http://aggregator.userland.com /validator/) checks 0.9x feeds. ■■ Online RSS 1.0 Validator (ldodds.com/rss_validator/1.0 /validator.html) checks 1.0 RSS feeds. ■■ Orchard RSS (http://orchard.sourceforge.net/) creates feeds using Python, Perl, or C. ■■ RSS Editor (http://rsseditor.mozdev.org/) is a Firefox extensions for creating/updating RSS feeds. ■■ RSS.py (mnot.net/python/RSS.py) uses the Python scripting language to generate and parse RSS. ■■ XML::RSS (http://search.cpan.org/author/EISEN/XML- RSS/) is Perl module for creating and parsing RSS. ■■ xpath2rss (mnot.net/xpath2rss/) uses XPath expressions to “scrape” Web sites and create RSS feeds. If you would like additional tutorial information about RSS, see Reuven Lerner’s tutorial on RSS syndication, “At the Forge — Syndication with RSS,” which appeared in the print version of Linux Journal in September 2004 and is also available on the Web at Linux Journal’s Web site at www.linuxjournal .com/article/7670. Another excellent tutorial is Mark Nottingham’s “RSS Tutorial for Content Publishers and Webmasters,” available on the Web at mnot.net/rss/tutorial/. An excellent book on the subject is Hacking RSS and Atom, written by Leslie Orchard (Wiley, ISBN 0-7645-9758-2). Providing Web Services 573 31_599496 ch24.qxd 8/30/05 7:30 PM Page 573 [...]... than a few hundred entries into smaller directories Many file systems, such as ext2 and ext 3, do not handle such cases efficiently at all, and the process of creating listings of large directories (with, for example, the ls or dir commands) causes vsftpd to use moderate amounts of memory and CPU If you are stuck with large directories, use a file system, such as XFS, JFS, or ReiserFS, designed to work... matches for the query term entered ■ ■ Metaphones — Searches for terms that sound like the query term but based on an awareness of the rules of English pronunciation ■ ■ Prefixes — Searches for terms that have a matching prefix, so, for example, searching for the prefix dia matches diameter, diacritical, dialogue, diabolical, and diadem ■ ■ Soundex — Searches for terms that sound like the query term... IP address Within each conf_dir, main.cf has a different $myhostname, $queue_directory, and $inet_interfaces setting, depending on the interface or IP it handles For example, if you have two virtual hosts, first.vhost.com and second.vhost.com, you might arrange it like this: For first.vhost.com, suppose that the Postfix’s configuration directory is /first/postfix Thus, the configuration file /first/postfix... tag) that ht://Dig notices and uses to generate document expiration notices ■■ Fuzzy searching — ht://Dig can perform searches using a number of well-known search algorithms Algorithms can be combined The currently supported search methods include the following: ■■ Accent stripping — Removes diacritical marks from ISO-Latin-1 chare acters so that, for example, e, , , e, e , and ˇ are considered the... process starts The default value is 10 0, but setting it to 0, for unlimited requests, will work just fine on a Red Hat system ■ ■ MaxKeepAliveRequests, 100 by default, sets the upper limit on the total number of requests from the same client on the same connection The following tips and suggestions appear in no particular order Your mileage may vary, and if breaks, you get to keep both pieces Some of... as root, execute the following command: # /usr/bin/rundig rundig works by reading the ht://Dig configuration file, /etc/htdig /htdig.conf, and spidering the site specified by the start_url variable In the stock installation, start_url is http://localhost rundig finds and 575 576 Chapter 24 follows each hyperlink specified in HTML files (that is, files with the extensions html, htm, or shtml) that point... FibreChannel If you have multiple LDAP data stores, situate each store on its own disk and, if possible, its own dedicated I/O controller in order to minimize I/O contention with other processes ■■ Filesystem tuning — On filesystems that support it, disable updating file access and modification timestamps, which will decrease the number of file operations that have to be performed by two-thirds Fewer CPU... Nonshared Memory per httpd Process The theory is that you should use physical RAM for system resources and caching active pages Leftover RAM should be used by httpd processes serving up active pages If you have more clients, you will end up swapping, which degrades performance If you have fewer clients, you will not be maximizing the available system resources In practice, you will have to decide what... out, so, again, the solution is to reduce the connection timeout for incoming email, modifying /etc/postfix /master.cf as follows: Optimizing Internet Services relay unix n smtp -o smtp_connect_timeout=2 -o smtp_helo_timeout=2 If you see that Postfix pegs disk I/O when processing incoming mail, the real solution is to get faster disks or to allocate one disk for logging, one disk for the mail queue,... Options FollowSymLinks, or if you do use Options SymLinksIfOwnerMatch, Apache performs extra system calls to check symbolic links For example, suppose you have the following configuration: DocumentRoot /var/www/htdocs Options SymLinksIfOwnerMatch If a client then requests /index.html, Apache performs an lstat() system call on /var, /var/www, /var/www/htdocs, and /var/www /htdocs/index.html . stripping — Removes diacritical marks from ISO-Latin-1 char- acters so that, for example, e, e , e , e · , e , and eˇ are considered the same letter (e) for search purposes. 574 Chapter 24 31_599496. have a matching prefix, so, for example, searching for the prefix dia matches diameter, diacritical, dialogue, diabolical, and diadem. ■■ Soundex — Searches for terms that sound like the query. VERSIONS There are different versions of the RSS specifications, at this point in time, three versions, 0.9x, 1. 0, and 2.0. The original version, RSS 0.9 1, was designed by Netscape and UserLand Software’s