816-819.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 182 行
HTML
182 行
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:Setting up a Gopher Service</TITLE>
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0672313723//-->
<!--TITLE=Linux Unleashed, Third Edition//-->
<!--AUTHOR=Tim Parker//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=50//-->
<!--PAGES=816-819//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="813-815.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="819-821.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>There are several types of files supported by Gopher, all given a unique one-character type code. The following is a list of valid codes:
</P>
<CENTER>
<TABLE WIDTH="90%"><TR>
<TD WIDTH="10%">• <TT>0</TT>
<TD WIDTH="90%">Plain text file
<TR>
<TD>• <TT>1</TT>
<TD>Directory
<TR>
<TD VALIGN="TOP">• <TT>2</TT>
<TD>CSO phonebook server (the hostname is the machine to connect to, the selector string is blank)
<TR>
<TD>• <TT>3</TT>
<TD>Error
<TR>
<TD>• <TT>4</TT>
<TD>BinHex Macintosh file
<TR>
<TD>• <TT>5</TT>
<TD>Binary DOS archive file
<TR>
<TD>• <TT>6</TT>
<TD>UNIX uuencoded file
<TR>
<TD>• <TT>7</TT>
<TD>Index-search server
<TR>
<TD VALIGN="TOP">• <TT>8</TT>
<TD>Pointer to text-based Telnet session (hostname is the machine name to connect to and selector string is the name to log in as)
<TR>
<TD>• <TT>9</TT>
<TD>Binary file
<TR>
<TD>• <TT>g</TT>
<TD>GIF file
<TR>
<TD>• <TT>h</TT>
<TD>HTML document
<TR>
<TD>• <TT>I</TT>
<TD>Graphic image
<TR>
<TD>• <TT>i</TT>
<TD>Unselectable inline text
<TR>
<TD>• <TT>M</TT>
<TD>MIME-encapsulated mail document
<TR>
<TD>• <TT>P</TT>
<TD>Adobe PDF file
<TR>
<TD>• <TT>s</TT>
<TD>Sound
<TR>
<TD VALIGN="TOP">• <TT>T</TT>
<TD>Pointer to 3270 Telnet session (hostname is machine to connect to and selector string is login name)
</TABLE>
</CENTER>
<P>The Gopher system uses a number of other files on a Linux system, all of which must exist. The files necessary for Gopher are as follows:
</P>
<DL>
<DD><B>•</B> <TT>tn3270</TT> or similar 3270 emulator—Used for Telnet 3270 connections.
<DD><B>•</B> <TT>kermit</TT> or <TT>zmodem</TT> communications programs—Used for downloading files. The binaries are usually called <TT>kermit</TT>, <TT>sz</TT>, <TT>sb</TT>, and <TT>sx</TT>.
<DD><B>•</B> graphics utility—If you allow the display of graphics, you need a graphics utility such as <TT>xv</TT>.
</DL>
<P>You can modify these requirements if you have a private site (such as for your local area network), but if you are offering open access you should have all the components.
</P>
<H3><A NAME="Heading3"></A><FONT COLOR="#000077">Configuring Gopher</FONT></H3>
<P>Installing and configuring Gopher (and Gopher+) is a matter of setting a number of configuration options before compiling the system software (it is usually not precompiled for you) and configuring some standard files. Gopher+ is done in the same manner, although with some extra parameters. Because Gopher is more likely to be on a Linux site than Gopher+, we’ll concentrate on that.
</P>
<P>Throughout this section, we will use filenames without full path extensions because it really doesn’t matter where you install the Gopher software, as long as the directory paths are set correctly. There is no real standard configuration for directory locations, so feel free to choose whatever works best for you.</P>
<H4 ALIGN="LEFT"><A NAME="Heading4"></A><FONT COLOR="#000077">The gopherd.conf File</FONT></H4>
<P>The configuration parameters for Gopher (and Gopher+) are in a file called <TT>gopherd.conf</TT>, which is read by the Gopher daemon <TT>gopherd</TT>. The default settings generally need a little modification, although many changes are simply changing commented lines to uncommented, and vice versa.</P>
<P>The first step is to create an alias for the Gopher service on your machine. Perform this step with the line that defines the <TT>hostalias</TT>. There should be a line in the file that looks like this:</P>
<!-- CODE SNIP //-->
<PRE>
hostalias: tpci
</PRE>
<!-- END CODE SNIP //-->
<P>The alias is used to find the Gopher server on your system and should not be directly tied to a real machine, so you can make changes whenever you wish. The best approach is to create an alias and tie it to a physical machine with DNS. If you are running a standalone machine, you can use either an alias tied to your machine name or your machine name directly.
</P>
<P>You can also control the number of Gopher connections allowed at one time. This is sometimes necessary to prevent a system from bogging down due to excessive user load. The maximum number of connections Gopher allows is given in a file, usually in the directory <TT>PIDS_Directory</TT>. A line in the <TT>gopherd.conf</TT> file usually has this variable commented out because early versions didn’t implement it properly or it was unstable. If you want to allow this feature, remove the comment symbol and make sure the directory it points to has the necessary files for your version of Gopher. The line usually looks like this:</P>
<!-- CODE SNIP //-->
<PRE>
#PIDS_Directory: /pids
</PRE>
<!-- END CODE SNIP //-->
<P>A better way to handle the load on your system is to use the <TT>MaxConnections</TT> keyword, which sets the number of clients you support concurrently. You have to experiment to determine the best balance between system load and user service. A good starting point for a fast Linux system (80486 or Pentium CPU) is 15 to 25 users. If you are going to run a Web server at the same time, you may want to cut down this number a little, though, to spare system resources. This variable is set like this:</P>
<!-- CODE SNIP //-->
<PRE>
MaxConnections: 15
</PRE>
<!-- END CODE SNIP //-->
<P>If the number of users is exceeded, an error message is generated when the connection is attempted. You can set a number of file decoders for your system. This is used when a user requests a file from Gopher and adds an extension (such as <TT>.Z</TT>, <TT>.gz</TT>, or <TT>.zip</TT>) for a compression or archive utility. The decoders recognize the extension the user supplies and invoke the proper utility to send the file properly decoded. Most <TT>gopherd.conf</TT> files have the following decoder lines already in the setup:</P>
<!-- CODE SNIP //-->
<PRE>
decoder: .Z /usr/ucb/zcat
decoder: .gz /usr/gnu/bin/zcat
#decoder: .adpcm /usr/openwin/bin/adpcm_dec
#decoder: .z /usr/gnu/bin/zcat
</PRE>
<!-- END CODE SNIP //-->
<P>The last two decoders are commented out and can be uncommented if you want to offer files in these formats through Gopher. You can also add other extensions by adding new lines with the binary name (and its full path).
</P>
<P>In addition, the amount of time a cache file stays valid should be set. This is controlled by the line using the keyword <TT>Cachetime</TT>. Set this value to a reasonable value, such as 180 seconds. You should have a line that looks like this in the <TT>gopherd.conf</TT> file:</P>
<!-- CODE SNIP //-->
<PRE>
Cachetime: 180
</PRE>
<!-- END CODE SNIP //-->
<P>You can use the <TT>gopherd.conf</TT> file to restrict access to some files on your system by using the <TT>ignore</TT> keyword. Usually the <TT>gopherd.conf</TT> file has a number of defined <TT>ignore</TT>s, such as these:</P>
<!-- CODE SNIP //-->
<PRE>
ignore: lib
ignore: bin
ignore: etc
ignore: dev
</PRE>
<!-- END CODE SNIP //-->
<P>Any file with this type of extension is ignored. If there is a particular file extension you want to protect, add it to the list. For example, if your accounting system uses the extension <TT>.acct</TT>, you can have the Gopher clients ignore all these files by adding this line:</P>
<!-- CODE SNIP //-->
<PRE>
ignore: acct
</PRE>
<!-- END CODE SNIP //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="813-815.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="819-821.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?