📄 rhl49.htm
字号:
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
MAN8DIR
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Man pages for gopherd</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SERVERDIR
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Gopher server (gopherd) and configuration file (gopherd.conf)</FONT>
</TABLE><P>For a Gopher client to run properly on your system, you must modify the CLIENTOPTS line in the Makefile.config file. The two options for the CLIENTOPTS line to control its behavior are as follows:
<BR>
<UL>
<UL>
<P>-DNOMAIL Forbids remote users from mailing files.
<BR>
</UL></UL>
<UL>
<UL>
<P>-DAUTOEXITONU Allows the Gopher client to be exited with the u command as well as q command.
<BR>
</UL></UL>
<P>To use either or both or these options, add them to the CLIENTOPS line like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">CLIENTOPTS = -DNOMAIL -DAUTOEXITONU</FONT></PRE>
<P>Four variables relating to the Gopher server must also be set. These specify the host domain name, the port Gopher should use to listen for connections, the location of the data files, and option flags.
<BR>
<P>The domain name is set with the DOMAIN variable. It should have a leading period in the name, such as:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">DOMAIN = .tpci.com</FONT></PRE>
<P>You do not need to set this variable, if the hostname command returns the fully qualified domain name of the server. In this case, leave the value blank.
<BR>
<P>The SERVERPORT variable defines the port Gopher uses to wait for services and is usually set for TCP port 70. This line usually looks like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">SERVERPORT = 70</FONT></PRE>
<P>If you are not allowing general access to your Gopher site by Internet users, you can change this value. However, if you want to allow Internet users (even a very small subset) to gain access, you should leave this as port 70. If you are setting up your
Gopher site for a small network only, then choose any port number you want (between 1024 and 9999) and make sure all the Gopher clients use that number, too.
<BR>
<P>The SERVERDATA variable defines the location of the data your Gopher server offers. Its default setting is usually as follows:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">SERVERDATA = /gopher-data</FONT></PRE>
<P>Set the variable to point to the file location you use for your Gopher items.
<BR>
<P>The SERVEROPTS variable accepts a number of keywords that change the behavior of the Gopher service. A typical entry looks like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">SERVEROPTS = -DSETPROCTITLE -DCAPFILES # -DBIO -DDL</FONT></PRE>
<P>Any keywords after the pound sign are ignored when Makefile runs, so you can adjust its location to set the options you want if the order of the variables allows such a simple approach. The following lists the meaning of the different keywords allowed
in the SERVEROPTS entry:
<BR>
<TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-DADD_DATE_AND_TIME
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Adds dates and times to titles.</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-DBIO
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Used only with the WAIS versions developed by Don Gilbert (wais8b5).</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-DDL
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Provides support for the dl database utility (requires the dl system in a directory variable called DLPATH and the DLOBJS line uncommented out to show the files getdesc.o and enddesc.o locations).</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-DCAPFILES
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Offers backwards compatibility with the cap directory.</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-DLOADRESTRICT
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Restricts user access based on the number of concurrent users (see the following section).</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-DSETPROCTITLE
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Sets the name displayed by ps command (BSD UNIX-based systems only).</FONT>
</TABLE><P>The conf.h file is used during the compilation to set other parameters about the Gopher service. The important settings, at least when setting up a Gopher service, are those that relate to the number of queries and timeout variables. These tend
to occur at the end of the conf.h file.
<BR>
<P>The WAISMAXHITS variable defines the maximum number of hits a query to a WAIS database can offer, usually set to around 40. This variable is defined like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">#define WAISMAXHITS 40</FONT></PRE>
<P>Note that the pound sign is not a comment symbol because this is written in C. The pound sign is an important part of the processor directive and should be left in place. There is no equal sign in the definition, either.
<BR>
<P>The MAXLOAD variable is used if the -DLOADRESTRICT keyword was used in the SERVEROPTS variable of Makefile.config. The MAXLOAD defines the maximum load average the Gopher service will respond to requests under (this value can be overridden on the
command line). The usual definition is like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">#define MAXLOAD 10.0</FONT></PRE>
<P>The READTIMEOUT and WRITETIMEOUT variables set the amount of time a service waits for a network read or write operation before timing out. The default settings are usually adequate. These lines look like the following:
<BR>
<PRE>
<FONT COLOR="#000080">#define READTIMEOUT (1*60)
#define WRITETIMEOUT (3*60)</FONT></PRE>
<P>The Gopher clients configuration is straight-forward. Begin by defining the Gopher servers the local machine connects to with the CLIENT1_HOST and CLIENT2_HOST entries. The Gopher client chooses one of the two (if both are defined) when it is started.
The entries look like this:
<BR>
<PRE>
<FONT COLOR="#000080">#define CLIENT1_HOST "gopher_serv.tpci.com"
#define CLIENT2_HOST "other_gopher_serv.tpci.com"</FONT></PRE>
<P>The ports to be used to connect to the hosts are defined with these options:
<BR>
<PRE>
<FONT COLOR="#000080">#define CLIENT1_PORT 70
#define CLIENT2_PORT 70</FONT></PRE>
<P>If you have a local service and don't want to use port 70 (to prevent access from the Internet, for example), set the proper port values. If only one Gopher server is used, set the second value to 0.
<BR>
<P>Define the language the Gopher client will use by choosing one value out of a number of options. The default is American English, set by this command:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">#define DEFAULT_LANG "En_US"</FONT></PRE>
<P>Other language defines are commented out below this one. If you want to change the default language, comment the American English setting and uncomment the one you want.
<BR>
<P>When all the configuration changes have been made, you can invoke the compilation process for the client and server with these commands:
<BR>
<PRE>
<FONT COLOR="#000080">make client
make server</FONT></PRE>
<P>Or you can do both client and server systems at once by using the make command with no argument. The programs and data files must be installed, too, using the command:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">make install</FONT></PRE>
<BR>
<A NAME="E69E511"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>WAIS and Gopher</B></FONT></CENTER></H4>
<BR>
<P>Gopher clients have the ability to use WAIS indexes to search for documents, but the system must be configured to allow this. We looked at WAIS in <A HREF="rhl48.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl48.htm">Chapter 48</A>, "Configuring a WAIS Site," so for the sake of providing WAIS
index access to Gopher, we will assume you have installed WAIS properly and have WAIS indexes ready for Gopher.
<BR>
<P>To provide WAIS services through Gopher, you may have to make a change in the WAIS source code. Examine the WAIS source code for a line that looks like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">if (gLastAnd) printf("search_word: boolean 'and' scored/n:);</FONT></PRE>
<P>This line should be commented out to provide Gopher services, so if it is not, add C comment symbols before and after the line, like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">/* if (gLastAnd) printf("search_word: boolean 'and' scored/n:); */</FONT></PRE>
<P>If the line was already commented out (or didn't exist) then you need not make any change. If you changed the line, though, you have to recompile WAIS by changing into the WAIS top directory and running the makefile (type the command make).
<BR>
<P>Next, examine the Gopher Makefile.config file and look for the WAISTYPE variable. It should be defined on a line like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">WAISTYPE = #-DFREEWAIS_0_4</FONT></PRE>
<P>Then, you have to link the Gopher and WAIS services. Suppose your Gopher source directory is /usr/gopher/source and the WAIS source directory is /usr/wais/source. You can link these services by entering the following commands:
<BR>
<PRE>
<FONT COLOR="#000080">cd /usr/gopher/source
ln -s /usr/wais/source/include ./ir
ln -s /usr/wais/source/client/ui .
ln -s /usr/wais/source/bin .</FONT></PRE>
<P>When Gopher is recompiled, it will make the links between Gopher and freeWAIS and allow the two services to interwork.
<BR>
<BR>
<A NAME="E68E387"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Setting Up Your Gopher Directories</B></FONT></CENTER></H3>
<BR>
<P>Gopher directories and files are quite simple to set up and follow standard naming conventions for the most part. Before you begin, though, you should know which documents and files are to be provided through Gopher to other users, and you should be
able to write a short description of each. (If you don't know the contents of a file, either read it or get the author to summarize the file for you.) To begin, we'll assume you will use only a single directory for all your Gopher documents.
<BR>
<P>Begin by changing to the top directory you use for your Gopher directories (which you may have to create if you haven't already done so). This directory should not be where the Gopher source and configuration files are located, for convenience. Simply
choose a useful name and create the directory. For example, to create the Gopher home directory /usr/gopher/data, you would issue a standard mkdir command:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">mkdir /usr/gopher/data</FONT></PRE>
<P>Change into your Gopher directory and copy the files you want to make available into it. When you have done that, you can create a descriptive filename for each file (instead of the more obtuse filenames usually used) up to 80 characters long. For
example, if you have a filename called q1.sales you may want to rename it to Company_Sales_1887_Q1 to help users identify the contents a little more easily.
<BR>
<P>The process for providing better filenames is to first create a .cap directory under your Gopher main directory (such as /usr/gopher/data/.cap). For each file in the main directory, you want to create a file in the .cap directory with the same name, but
with a name and number. For example, suppose you have a file called q1.sales in /usr/gopher/data. In /usr/gopher/data/.cap you would create a file with the same name, q1.sales, which has the following contents:
<BR>
<PRE>
<FONT COLOR="#000080">Name=Company Sales for the First Quarter, 1887
Numb=1</FONT></PRE>
<P>The Name entry can have spaces or other special symbols in it, because it is echoed as a complete string. The Numb entry is for the location of the entry on your Gopher menu. For example, suppose you had the preceding entry and two other files, shown by
using cat to display their contents:
<BR>
<PRE>
<FONT COLOR="#000080">$ cat q1.sales
Name=Company Sales for the First Quarter, 1887
Numb=1
$ cat q2.sales
Name=Company Sales for the Second Quarter, 1887
Numb=2
$cat q3.sales
Name=Company Sales for the Third Quarter, 1887
Numb=3</FONT></PRE>
<P>When these entries are displayed in a Gopher menu they will look like this:
<BR>
<PRE>
<FONT COLOR="#000080">1. Company Sales for the First Quarter, 1887
2. Company Sales for the Second Quarter, 1887
3. Company Sales for the Third Quarter, 1887</FONT></PRE>
<P>The order of filenames in the .cap directory doesn't matter, but you shouldn't have the same Numb entry more than once.
<BR>
<P>An alternative to using the .cap directory approach (which allows for easy addition of new files) is to use a single master file for each document you are making available. This file goes in your Gopher top directory and is called .names. Here's the
.names file for the same three files just mentioned:
<BR>
<PRE>
<FONT COLOR="#000080">$ cd /usr/gopher/data
$ cat .names
# My Gopher main .names file
Path=./q1.sales
Name=Company Sales for the First Quarter, 1887
Numb=1
Path=./q2.sales
Name=Company Sales for the Second Quarter, 1887
Numb=2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -