📄 ch50.htm
字号:
</UL>
<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.
<H3 ALIGN="CENTER"><A NAME="Heading5<FONT COLOR="#000077">Configuring Gopher</FONT></H3>
<P>Installing and configuring Gopher (and Gopher+) is a matter of setting a number
of configuration options prior to 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. Since 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.
<H4 ALIGN="CENTER"><A NAME="Heading6<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:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">hostalias: tpci
</FONT></PRE>
<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 stand-alone machine, you can either use an alias tied to your machine name or use
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:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">#PIDS_Directory: /pids
</FONT></PRE>
<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. This variable
is set like this:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">MaxConnections: 15
</FONT></PRE>
<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:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">decoder: .Z /usr/ucb/zcat
decoder: .gz /usr/gnu/bin/zcat
#decoder: .adpcm /usr/openwin/bin/adpcm_dec
#decoder: .z /usr/gnu/bin/zcat
</FONT></PRE>
<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 to a reasonable
value, such as 180 seconds. You should have a line that looks like this in the <TT>gopherd.conf</TT>
file:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Cachetime: 180
</FONT></PRE>
<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 will have a number of defined <TT>ignore</TT>s, such as these:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">ignore: lib
ignore: bin
ignore: etc
ignore: dev
</FONT></PRE>
<P>Any file with this type of extension is ignored. If you have 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 could have the Gopher clients ignore
all these files by adding this line:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">ignore: acct
</FONT></PRE>
<P>Note that these <TT>ignore</TT> statements work only with file extensions. To
be more broad, you can use wildcards and the keyword <TT>ignore_patt</TT> (for ignore
pattern). For example, the line<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">ignore_patt: ^usr$
</FONT></PRE>
<P>ignores any file with the letters <TT>usr</TT> at the beginning of the name.
<H4 ALIGN="CENTER"><A NAME="Heading7<FONT COLOR="#000077">The gopherdlocal.conf
File</FONT></H4>
<P>In the file <TT>gopherdlocal.conf</TT>, you have to make two small changes to
identify the system administrator, otherwise your system generates many annoying
notes. The lines in the <TT>gopherdlocal.conf</TT> file look like this by default:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Admin: blank
AdminEmail: blank
</FONT></PRE>
<P>If you do not change these entries to actual values, Gopher can generate all kinds
of weird error messages. The <TT>Admin</TT> field usually has the administrator's
name and sometimes a telephone number. For example, the file could be filled out
as follows:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Admin: Yvonne Chow, 555-1212
AdminEmail: ychow@chatton.com
</FONT></PRE>
<P>Another setting you should provide in the <TT>gopherdlocal.conf</TT> file is the
<TT>Abstract</TT>, a short description of what your particular Gopher service provides.
If you don't change the default setting, users get a message prompting them to request
the <TT>Abstract</TT>, so you may as well do it right away. Multiple lines in an
abstract value are followed by a backslash to show the continuation. A sample <TT>Abstract</TT>
setting looks like this:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Abstract: This server provides sound and graphics files \
collected by the administrator on a recent trip to Outer \
Mongolia.
</FONT></PRE>
<P>General information about your site is provided with a number of general settings
for the site name, the organization that runs the site, your machine's geographic
location, the latitude and longitude of your site, and a time zone setting. You can
leave these blank if you want, but providing the information leads to a more complete
Gopher site. The settings in a sample <TT>gopherdlocal.conf</TT> file look like this:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Site: Explore_Mongolia
Org: Mongolia Tourist Bureau
Loc: North Bay, Ontario, Canada
Geog: blank
TZ: EDT
</FONT></PRE>
<P>The setting of <TT>blank</TT> for <TT>Geog</TT> leaves the setting with no value.
Obviously, the system administrator didn't know the latitude and longitude settings.</P>
<P>You can set a language option used by Gopher clients to show what language most
of the documents available on your site are written in. For example,<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Language: En_US
</FONT></PRE>
<P>sets the language to American English.</P>
<P>The setting <TT>BummerMsg</TT> is used to display a brief text string to a user
who exceeds your maximum number of concurrent users or causes an error when accessing
the system. The default value is this:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">BummerMsg: Sorry, we have exceeded the number of permissible users
</FONT></PRE>
<P>You can change this to whatever message you want. Try not to be rude or obnoxious
because you never know who will get this message.</P>
<P>The last step in modifying the <TT>gopherdlocal.conf</TT> file is to set access
procedures for users who log in to your Gopher server. Limiting the users who can
get to your server is done through entries with the keyword <TT>access</TT>. The
general format of the access line is<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">access: hostname permissions num_users
</FONT></PRE>
<P>where hostname is either the name or IP address of the host that is connecting
to your server, permissions is the permission set for those users, and num_users
is the maximum number of users that can be connected to the service concurrently.</P>
<P>The permissions are set using any combination of the following four words, either
as they are or preceded by an exclamation mark to mean "not allowed." These
are the permission keywords:
<UL>
<LI><TT>browse</TT>--May examine directory contents. If this is forbidden, users
can access entries, but they can't get directory contents.
<P>
<LI><TT><BR>
ft</TT>--Allows server to act as gateway to FTP services.
<P>
<LI><TT>read</TT>--May access a file. If forbidden, the users get the <TT>BummerMsg</TT>
when they ask for the file.
<P>
<LI><TT>search</TT>--May access indexes (type <TT>7</TT> items). If forbidden, access
to the indexes is not allowed. This is used primarily with Gopher+.
</UL>
<P>For example, to set access permissions to allow up to 10 users from the network
<TT>chatton.com</TT> to access your Gopher server with full rights, you would add
a line like this:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">access: chatton.com browse ftp read search 10
</FONT></PRE>
<P>There is at least one space between each entry, even between permissions. The
access entry</P>
<PRE><FONT COLOR="#0066FF">access: bignet.org !browse !ftp read search 3
</FONT></PRE>
<P>allows three concurrent users from <TT>bignet.org</TT> to access the Gopher server
and read and search, but not use FTP gateways or browse the directory listings.</P>
<P>If you are using IP addresses, you can use a subset of the IP address to indicate
the entire network. For example, if <TT>bignet.com</TT>'s network address is 147.12,
you can indicate the entire network with a line like this:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">access: 147.12. !browse !ftp read search 3
</FONT></PRE>
<P>You must follow the last quad of numbers specified in the IP address with a period;
otherwise, 147.120 through 147.129 will also have the same permissions (because they
match the digits specified).</P>
<P>If you want to enable access from a particular machine, you can do that, too.
For example, to allow your friend's <TT>darkstar</TT> machine to access your Gopher
server with full permissions, you would add a line like this:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">access: darkstar.domain.name browse ftp read search 1
</FONT></PRE>
<P>Most general Gopher servers tend to allow anyone to connect, so they use a default
entry to refer to anyone not explicitly defined by another access entry. The default
setting is usually like this:</P>
<PRE><FONT COLOR="#0066FF">access: default !browse !ftp read search 15
</FONT></PRE>
<P>This allows anyone to read and search Gopher directories, but not move through
them or use your machine as an FTP gateway.
<H4 ALIGN="CENTER"><A NAME="Heading8<FONT COLOR="#000077">Setting Up the Makefile</FONT></H4>
<P>Two files need modification for the compilation process to proceed properly: <TT>Makefile.config</TT>
and <TT>conf.h</TT>. With many versions of Gopher available on Linux systems, the
configuration parameters these files need have already been set, but you should check
the values carefully to prevent problems.</P>
<P>The <TT>Makefile.config</TT> file (used by <TT>Makefile</TT> to build the executables)
is a lengthy file, so you should be careful while moving through it to avoid accidental
changes. The important areas to examine are the directory definitions and server
and client settings. These are dealt with individually in the following sections.</P>
<P>One setting you may wish to alter is the debugging utility, which is enabled by
default in most systems. This can help you get the system running properly, but when
the operation is correct, you should recompile the source with the debugging features
removed to make the process faster and smaller, as well as to reduce debug information
overhead. To remove debugging features, comment out the <TT>DEBUGGING</TT> line so
it looks like this:</P>
<PRE><FONT COLOR="#0066FF">#DEBUGGING = -DDEBUGGING
</FONT></PRE>
<P>By default this line is probably not commented out.</P>
<P>The directory definitions are usually in a block with five to seven entries, depending
on the number of entries for the man pages. A typical directory definition block
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -