📄 lsg45.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 filenames (which were not needed in .cap because 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>
<BR>
<A NAME="E69E260"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Using Links</B></FONT></CENTER></H4>
<BR>
<P>You can get a little fancier with Gopher and have a menu item lead to another menu, or to another machine entirely. You can do this 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 it can be any type of description you want regardless of what else is in the link file. The Type field has a number showing the type of document the file links to. Valid numbers are as follows:
<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 a little shorter.
<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 sign 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 is:
<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>In this example, 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="E68E240"></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 will have a command line similar to this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">/usr/local/etc/gopherd /usr/gopher/gopher-data 70</FONT></PRE>
<P>This line 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 flags mirror entries in the configuration files. The following are valid flags:
<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>
Uses inetd to invoke gopherd</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-L
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Specifies the maximum load average when followed by a value</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
-l
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Specifies 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 files 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 filesystem structure for the gopher area (as you did with FTP: see <A HREF="lsg43.htm">Chapter 43</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>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>The entry in /etc/inetd.conf looks like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gopher stream tcp nowait root /usr/local/etc/gopherd gopherd -I -u username</FONT></PRE>
<P>In this entry, 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 command like 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 issue a command like this:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gopherls /usr/wais/gopher/data</FONT></PRE>
<P>This command specifies your Gopher data directory. You can use this technique to test new Gopher directories as you develop them.
<BR>
<BR>
<A NAME="E68E241"></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 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 to 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>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 gene<A NAME="I2"></A>ral Internet access), the e-mail account of the Gopher administrator, and a short paragraph describing your service. You can also provide a string that gives the path to the data directory, if you want. Because most Gopher systems start in the root directory, however, this string isn't needed unless you have sub-menus for different purposes.
<BR>
<BR>
<A NAME="E68E242"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Summary</B></FONT></CENTER></H3>
<BR>
<P>After you have done all that, your Gopher service should be ready to use. You 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 lots of information you want to share. Although the configuration process can take a while, the Gopher system tends to work very well once it is completed.
<P ALIGN=LEFT>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -