1. Trang chủ
  2. » Công Nghệ Thông Tin

Red Hat Linux Networking , System Administration (P21) pot

30 342 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

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

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Squirrel-If your IMAP server does not reside on the same system and the Web serverhosting SquirrelMail, edit SquirrelMail’s configuration file, /usr/share/squirrelmail/config/config.php,

Trang 1

Figure 24-4 Viewing the SquirrelMail login screen.

Login using a user account you know has email The user’s home Mail page should resemble Figure 24-5

Squirrel-If your IMAP server does not reside on the same system and the Web serverhosting SquirrelMail, edit SquirrelMail’s configuration file, /usr/share/squirrelmail/config/config.php, and modify the line that beginswith $imapServerAddress (near line 29) By default, it reads

$imapServerAddress = ‘localhost’;

Figure 24-5 Viewing a user’s SquirrelMail home page.

Trang 2

Change ‘localhost’ to reflect the name of the IMAP server For example, ifthe IMAP server is named imap.example.com, the modified line should read:

con-# /usr/share/squirrelmail/config/conf.pl

The resulting screen should resemble Figure 24-6

T I P 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.

Trang 3

The key groups of settings you might want to change are the OrganizationPreferences, which enable you to modify SquirrelMail’s overall appearance;Server Settings, which is where you set the IMAP server name and the defaultdomain 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 havenot already been saved will be discarded

Many of the settings you make using SquirrelMail’s configuration tool areglobal 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-relatedsettings, you should view the configuration test page to make sure that thechanges worked and had the desired effect The configuration test page can sig-nificantly simplify tracking down configuration mistakes and convenientlyincludes 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.

Trang 4

Figure 24-8 Testing SquirrelMail configuration changes.

SquirrelMail’s interface provides all the features you would expect in abrowser-based email client and should keep your mobile users happy If youneed 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 ments an XML format for distributing news headlines over the Web, a process

imple-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 anews-headline style format The headline information includes a URL thatlinks 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

Trang 5

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 eventsoccurring in the project, such as releases, updates, and meetings Popular blogsites use RSS to notify people of the latest blog entries If you or your usershave 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.91RSS specification (See the sidebar “Sorting out RSS Versions” for a discussion

of the competing RSS versions.)

N OT E 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 sitevisitors might use it Many people track news and other RSS feeds using an

RSS aggregator An aggregator is an application or browser extension that lects (or aggregates) RSS feeds from a list of sites that you specify and presents

col-all of them in a single interface Most aggregators can understand both plainvanilla RSS feeds and the more feature-rich Atom feeds One of our favoritefeed aggregators is the Firefox extension called Sage (see Figure 24-10)

Trang 6

Figure 24-10 Using the Sage RSS aggregator in Firefox.

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.

Trang 7

On the right side of the browser screen, Sage shows article summaries Youcan click these summaries to view the entire article Notice that the left side ofthe screen contains the Sage sidebar The sidebar is always present (unless youclose it), which makes it easy to jump to the news or other RSS feed item thatinterests you The upper portion of the sidebar lists each individual feed thatyou track The lower portion of the Sage sidebar lists each individual feed itemavailable from the feed that is currently selected in the upper portion of thesidebar 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? turally, any sort of list-oriented information, that is, information that can be

Struc-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, orwhitepapers

■■ If your Web site (rather, the Web site you maintain) frequently updatesdocuments, you might consider providing an RSS feed that lists new orupdated documents (or individual pages)

■■ Calendars of events, such as company appearances at trade shows, usergroup meetings, or listings of training sessions

■■ Listings of available jobs

As a final suggestion, RSS feeds can be even more useful on a companyintranet 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 personnelforms 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 importantpaperwork

Creating the Feed File

Listing 24-1 shows a minimal RSS feed file You can type this as a model foryour own file, type in the listing yourself, or use the included feed.rss filefrom this chapter’s code directory on the CD-ROM

Trang 8

Listing 24-1 A bare-bones RSS feed.

This file contains the key tags you need to create an RSS feed, which Table24-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

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

Trang 9

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 Theversionattribute of the <rss> tag is required because it enables RSS readers(usually called feed aggregators) to know which version of RSS to support andhow to interpret the contents of the RSS file

The meat of an RSS feed appears in <item> tags The information in a feeditem’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 theURL 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 ers over the headline link, or it might be totally ignored, depending on the RSSreader in use

hov-Turning on an RSS Feed

Naturally, Web browsers and feed aggregators need to know that your Website has an RSS feed and where to find it To do this, you need to add somemetadata 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”

<link rel=”alternate” type=”application/rss+xml” href=”feed.rss”

Trang 10

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 lowimpact 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 thatautomate the creation of RSS feeds, and some content management systemseven include tools to create RSS feeds automatically Other tools exist that youcan use to validate your RSS feeds for correct format This section ends with alist 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 ReuvenLerner’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 “RSSTutorial for Content Publishers and Webmasters,” available on the Web atmnot.net/rss/tutorial/ An excellent book on the subject is Hacking RSS

and Atom, written by Leslie Orchard (Wiley, ISBN 0-7645-9758-2).

Trang 11

Adding Search Functionality

If you have more than a few pages of content on your Web site, you will needsome sort of search capability to help people find the information for whichthey’re looking While a site map might suffice for small sites, anything largerthan a dozen pages or so needs to be searchable Fedora Core and RHEL shipwith the ht://Dig search engine installed and ready to go This sectiondescribes how to get it going

Getting Started with ht://Dig

ht://Dig is a complete document searching and indexing system designed for

a single domain or an intranet It is not meant to replace the big global searchengines like Google, Yahoo!, or Excite Rather, it is intended for use on singlesites and domains and is especially well suited for intranets, primarily becauseht://Dig was initially developed for campus use at San Diego State University.Although ht://Dig is intended for use on a small scale, the word “small” is rel-ative; it is quite capable of searching sites or domains that comprise multipleservers and thousands of documents ht://Dig can handle sites or domainsthat consist of multiple servers because it has a built-in Web spider that can tra-verse a site and index all the documents it encounters ht://Dig handles thou-sands of documents because it uses a static search index that is very fast.Other ht://Dig features include the following:

■■ Character set collation— SGML entities such &eacute; and Latin-1 characters can be indexed and searched

ISO-■■ Content exclusion— Support for excluding content from indexingusing a standard robots.txt file, which defines files and filenamepatterns to exclude from searches

■■ Depth limiting— Queries can be limited to match only those ments that are given number of links or clicks away from the initialsearch document

docu-■■ Expiration notification— Maintainers of documents can be notifiedwhen a document expires by placing special meta-information inside

an HTML document (using the HTML <meta> tag) that ht://Dignotices and uses to generate document expiration notices

■■ Fuzzy searching— ht://Dig can perform searches using a number ofwell-known search algorithms Algorithms can be combined The cur-rently supported search methods include the following:

■■ Accent stripping — Removes diacritical marks from ISO-Latin-1

char-acters so that, for example, e, e¯, e˘, e·

, e¸, and eˇare considered thesame letter (e) for search purposes

Trang 12

■■ Exact match — Returns results containing exact 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.

■■ Stem searches — Searches for variants of a search term that use the

same root word but different stems

■■ Substrings — Searches for terms that begin with a specified

sub-string, so searching for phon* will match phone, phonetic, andphonicsbut not telephone.

■■ Synonyms — Searches for words that mean the same thing as the

query term, causing ht://Dig to perform return results that includesynonyms

■■ Keyword optimization— You can add keywords to HTML documents

to assist the search engine using the HTML <meta> tag

■■ Output customization— Search results can be tailored and customizedusing HTML templates

■■ Pattern matching— You can limit a search to specific parts of thesearch database by creating a query that returns only those documentswhose URLs match a given pattern

■■ Privacy protection— A protected server can be indexed by instructinght://Dig to use a given username and password when indexing pro-tected servers or protected areas of public servers

As you can see, ht://Dig is a full-featured search engine It is also easy touse and maintain, so try it and see if it will meet your needs

To get started, you need to create the initial search database and then createsome customized indexes to facilitate fast searching Fortunately, you do nothave to do this manually ht://Dig uses a script named rundig to automatedatabase creation and index maintenance So, as root, execute the followingcommand:

# /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 Inthe stock installation, start_url is http://localhost rundig finds and

Trang 13

follows each hyperlink specified in HTML files (that is, files with the sions html, htm, or shtml) that point to documents in the domain it isindexing, creating a database of words in each document and another data-base of the URLs Additional steps massage these databases into a searchable

exten-format and, optionally, create various indexes for so-called fuzzy searches, such

as soundex and metaphone searches (searches for words that sound like otherwords) and prefix matches (searches for words that contain specified prefixes)

If you have a lot of content in files that are not straight HTML, such as textfiles, files created with SSI, and so forth, start_url can also point to a filethat contains a list of URLs to check For example, consider the followingstart_urlstatement in /etc/htdig/htdig.conf:

<title>Issue Tracker Source Files</title>

<link rel=”stylesheet” type=”text/css” media=”screen”

ht://Dig will index the contents of each file linked in digme.html

If you have a lot of content in your Web document trees, the database ation and indexing process can take a while Otherwise, when the commandprompt returns, you can test out the search engine To do so, point your Webbrowser at http://localhost/htdig/ (replace localhost with thename of your server if you are not accessing it locally) You should see a screenthat resembles Figure 24-12

cre-Type in a search term (try documentroot) and press Enter or click the Search

button The search results should resemble Figure 24-13

Trang 14

Figure 24-12 Viewing the ht://Dig search page.

Figure 24-13 ht://Dig search results for the word “documentroot.”

Trang 15

The search results shown in a short format so you can see the number ofmatches Notice that the search results are case-insensitive.

After you satisfy yourself that the search engine is working, you will want

or need to update the search databases as content is added to the server Theeasiest way to accomplish this is to execute rundig on a periodic basis usingcron How often you update the indexes is up to you, but it should reflect thefrequency with which content on the server changes Listing 24-2 shows asample script you can use, rundig.cron

#!/bin/sh

# rundig.cron - Update ht://Dig search database /usr/bin/rundig –s

Listing 24-2 Cron script to execute rundig.

The -s option causes rundig to display some runtime and database tics when it is finished The output might resemble the following:

statis-htdig: Run complete htdig: 1 server seen:

htdig: localhost:80 2 documents

HTTP statistics

===============

Persistent connections : Yes HEAD call before GET : Yes Connections opened : 2 Connections closed : 1 Changes of server : 0 HTTP Requests : 5 HTTP KBytes requested : 5.68164

Make the script executable (chmod 755 rundig.cron) and place in /etc

/cron.dailyif you want to run it every day; /etc/cron.weekly if youwant to run it once a week, or /etc/cron.monthly if you want to run it on

a monthly basis

After you have a cron job in place to update ht://Dig’s database and searchindexes, you are done Check the output of the cron job periodically (it willmailed to the root user) to make sure that the index is being updated properly.Beyond that, ht://Dig takes care of itself, which is just the arrangement a busysystem administrator likes

N OT E For more information about ht://Dig, visit its project Web page,

http://www.htdig.org/.

Ngày đăng: 07/07/2014, 09:20

TỪ KHÓA LIÊN QUAN