📄 rhl49.htm
字号:
Path=./q3.sales
Name=Company Sales for the Third Quarter, 1887
Numb=3</FONT></PRE>
<P>As you can see, this format contains the same information but adds the filename (which was not needed in .cap since the filenames were the same). One advantage to using a .names file is that you can reorder your menu entries much more easily because you
only have one file to work with instead of several. Also, the .names file enables you to add an abstract describing the file. For example, you could have the following entry in a .names file:
<BR>
<PRE>
<FONT COLOR="#000080">Path=./gopher
Name=How to Set up A Gopher Service
Numb=16
Abstract=This document shows the steps you need to take to
set up a Gopher service.</FONT></PRE>
<P>You can get a little fancier with Gopher and have a menu item lead to another menu, or to another machine entirely. This is done with links, controlled by a link file, which ends with .link. A .link file has five pieces of information in it, in the same
format as this example:
<BR>
<PRE>
<FONT COLOR="#000080">Name=More Sales Info
Type=1
Port=70
Path=/usr/gopher/data/more_sales
Host=wizard.tpci.com</FONT></PRE>
<P>The Name entry is what a user sees on the Gopher menu, and can be any type of description you want, regardless of what else is in the link file. The Type field has a code showing the type of document the file links to. The following are all valid codes:
<BR>
<TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
0
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Text</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
1
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Directory</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
2
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
CSO name server</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
7
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Full text index</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
8
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
telnet session</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
9
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Binary</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
h
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
HTML file</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
I
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Image file</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
M
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
MIME file</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
s
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Sound file</FONT>
</TABLE><P>These types are the same as the list shown earlier in this chapter for the types of files Gopher supports, although it's a little shorter here.
<BR>
<P>The Port field is the port for a connection to a remote system (if that's where the link leads), and the Path field is where the file is on the local or remote server. The Host field, not surprisingly, is the name of the host the file resides on. If you
are setting up a link to another machine via FTP or WAIS, you need to specify the path to include the service name and any arguments. For example, if your Gopher menu leads users to a file on another machine through FTP, your link file may look like this:
<BR>
<PRE>
<FONT COLOR="#000080">Name=More Sales Info
Type=1
Port=+
Path=ftp:chatton.bigcat.com@/usr/gopher/cats
Host=+</FONT></PRE>
<P>The plus signs used in the Port and Host fields instruct the FTP service on the remote machine to return results to this machine using default ports (such as TCP port 21 for FTP). For a link to a WAIS directory, the format would be:
<BR>
<PRE>
<FONT COLOR="#000080">Name=More Sales Info
Type=7
Port=+
Path=waisrc:/usr/wais/data
Host=+</FONT></PRE>
<P>Finally, you may want to have a menu item execute a program. You can do this by having the Path field use the exec command:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">Path=exec: "args" : do_this</FONT></PRE>
<P>where do_this is the program you want to execute and args are any arguments to be passed to do_this. If you have no arguments to pass, leave the quotation marks empty. This format is a little awkward, but it does work.
<BR>
<BR>
<A NAME="E68E388"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Starting Gopher</B></FONT></CENTER></H3>
<BR>
<P>A Gopher server can be started either from the rc startup files, from the command line, or from the inetd daemon. From the command line or the rc files, you need a command line similar to this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">/usr/local/etc/gopherd /usr/gopher/gopher-data 70</FONT></PRE>
<P>which starts the daemon with the directory the startup Gopher menus reside in and the port number for connections.
<BR>
<P>The gopherd command line accepts a number of optional flags to control its behavior, although most mirror entries in the configuration files. Valid flags are as follows:
<BR>
<TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-C
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Disables directory caching</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-c
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Runs without chroot restrictions</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-D
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Enables debugging</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-I
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
inetd is used to invoke gopherd</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-L
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Followed by a value for the maximum load average</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-l
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Log file to record connections (filename follows the option)</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-o
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Specifies an alternate configuration file from gopherd.conf (filename follows the option)</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-u
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Sets the name of the owner running gopherd (valid username must follow the option)</FONT>
</TABLE><P>To help secure your system, use chroot to create a separate file system structure for the Gopher area (as you did with FTP: see <A HREF="rhl47.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl47.htm">Chapter 47</A>, "Setting Up an FTP and Anonymous FTP Site"). The -c option is not as
secure as running gopherd with chroot active. Also, the -u option should be used to make gopherd run as a standard user's process, instead of as root. This helps protect against holes in the daemon that a hacker could exploit.
<BR>
<P><A NAME="I2"></A>If you want to run Gopher under inetd (started whenever a request for the service arrives), modify the /etc/services and /etc/inetd.conf file to include a line for Gopher. Normally, the entry in /etc/services looks like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gopher 70/tcp</FONT></PRE>
<P>and the entry in /etc/inetd.conf looks like this:
<BR>
<PRE>
<FONT COLOR="#000080">gopher stream tcp nowait root
/usr/local/etc/gopherd gopherd -I -u username</FONT></PRE>
<P>where username is the name of the user to run gopherd as (you can set up a specific account for gopher in /etc/passwd with standard permissions).
<BR>
<P>Once the Gopher server process is up and running, you can test your Gopher installation. You will need a Gopher client. Use the Gopher client to connect to your Gopher server (using your host name), and you should see the top directory of your Gopher
resources. Another way to test your Gopher system is to use telnet. Use telnet to connect to the Gopher port, using a commandlike this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">telnet gopher 70</FONT></PRE>
<P>If the connection is properly made, you will see your Gopher system on the screen.
<BR>
<P>Yet another alternative to test your system is to use the program gopherls, which requires the name of the directory your Gopher source resides in. To start gopherls, you would issue a command as follows:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gopherls /usr/wais/gopher/data</FONT></PRE>
<P>specifying your Gopher data directory. You can use this technique to test new Gopher directories as you develop them.
<BR>
<BR>
<A NAME="E68E389"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Letting the World Know</B></FONT></CENTER></H3>
<BR>
<P>Because you have spent a lot of time setting up your Gopher service, you can now let everyone else on the Internet know about it. (Of course, you should only do this when your Gopher service is ready, and if you want to allow general access. Don't
follow these steps if you are granting access only to a few people or your local area network.)
<BR>
<P>To have your Gopher service listed in the main Gopher service directories, send an e-mail message to the address:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gopher@boombox.micro.umn.edu</FONT></PRE>
<P>and include the Gopher service's full name as it appears on your main menu, your host's name and IP address, the port number Gopher uses (which should be TCP port 70 for general Internet access), the e-mail account of the Gopher administrator, and a
short paragraph describing your service. If you want, you can also provide a string that gives the path to the data directory, although since most Gopher systems start in the root directory, this string isn't necessary unless you have sub-menus for
different purposes.
<BR>
<BR>
<A NAME="E68E390"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Summary</B></FONT></CENTER></H3>
<BR>
<P>After all that, your Gopher service should be ready to use. You do need to set up the Gopher file entries, but that is beyond the scope of this chapter. Consult a good Internet or Gopher book for more information on Gopher directories, files, and
entries. Gopher is a handy utility if you have volumes of information you want to share, and although the configuration process can take a while, once it's completed, the Gopher system tends to work very well.
<P ALIGN=LEFT>
<A HREF="rhl48.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl48.htm" TARGET="_self"><IMG SRC="purprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="#I0" TARGET="_self"><IMG SRC="purtop.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purtop.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Page Top"></A>
<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm" TARGET="_self"><IMG SRC="purtoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="rhl50.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl50.htm" TARGET="_self"><IMG SRC="purnext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -