⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch50.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 4 页
字号:


<P>The <TT>Name</TT> entry can have spaces or other special symbols in it, because



it is echoed as a complete string. The <TT>Numb</TT> 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 <TT>cat</TT> to display their contents:</P>



<PRE><FONT COLOR="#0066FF">$ cat q1.sales



Name=Company Sales for the First Quarter, 1997



Numb=1







$ cat q2.sales



Name=Company Sales for the Second Quarter, 1997



Numb=2







$cat q3.sales



Name=Company Sales for the Third Quarter, 1997



</FONT></PRE>







<PRE><FONT COLOR="#0066FF">Numb=3



</FONT></PRE>



<P>When these entries are displayed in a Gopher menu they will look like this:<FONT



COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">1. Company Sales for the First Quarter, 1997



2. Company Sales for the Second Quarter, 1997



3. Company Sales for the Third Quarter, 1997



</FONT></PRE>



<P>The order of filenames in the <TT>.cap</TT> directory doesn't matter, but you



shouldn't have the same <TT>Numb</TT> entry more than once.</P>



<P>An alternative to using the <TT>.cap</TT> 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 <TT>.names</TT>.



Here's the <TT>.names</TT> file for the same three files just mentioned:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">$ cd /usr/gopher/data



$ cat .names



# My Gopher main .names file







Path=./q1.sales



Name=Company Sales for the First Quarter, 1997



Numb=1







Path=./q2.sales



Name=Company Sales for the Second Quarter, 1997



Numb=2







Path=./q3.sales



Name=Company Sales for the Third Quarter, 1997







Numb=3



</FONT></PRE>



<P>As you can see, this format contains the same information but adds the filename



(which was not needed in <TT>.cap</TT> since the filenames were the same). One advantage



to using a <TT>.names</TT> 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



<TT>.names</TT> file enables you to add an abstract describing the file. For example,



you could have the following entry in a <TT>.names</TT> file:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">Path=./gopher



Name=How to Set up A Gopher Service



Numb=16



Abstract=This document shows the steps you need to take to 



</FONT></PRE>







<PRE><FONT COLOR="#0066FF">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 <TT>.link</TT>. A <TT>.link</TT> file has five pieces of information



in it, in the same format as this example:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">Name=More Sales Info



Type=1



Port=70



Path=/usr/gopher/data/more_sales



</FONT></PRE>







<PRE><FONT COLOR="#0066FF">Host=wizard.tpci.com



</FONT></PRE>



<P>The <TT>Name</TT> 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 <TT>Type</TT>



field has a number showing the type of document the file links to. The following



are all valid numbers: 



<PRE><FONT COLOR="#0066FF"><TT>0</TT> Text</FONT></PRE>







<PRE><FONT COLOR="#0066FF"><TT>1</TT> Directory</FONT></PRE>







<PRE><FONT COLOR="#0066FF">2 CSO name server</FONT></PRE>







<PRE><FONT COLOR="#0066FF"><TT>7</TT> Full text index</FONT></PRE>







<PRE><FONT COLOR="#0066FF"><TT>8</TT> telnet session</FONT></PRE>







<PRE><FONT COLOR="#0066FF"><TT>9</TT> Binary</FONT></PRE>







<PRE><FONT COLOR="#0066FF"><TT>h</TT> HTML file</FONT></PRE>







<PRE><FONT COLOR="#0066FF"><TT>I</TT> Image file</FONT></PRE>







<PRE><FONT COLOR="#0066FF"><TT>M</TT> MIME file







<TT>s</TT> Sound file</FONT></PRE>



<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.</P>







<P>The <TT>Port</TT> field is the port for a connection to a remote system (if that's



where the link leads), and the <TT>Path</TT> field is where the file is on the local



or remote server. The <TT>Host</TT> 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:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">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 <TT>Port</TT> and <TT>Host</TT> 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, this would be



the format:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">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 <TT>Path</TT> field use the <TT>exec</TT> command:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">Path=exec: &quot;args&quot; : do_this



</FONT></PRE>



<P>In this command, 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.



<H3 ALIGN="CENTER"><A NAME="Heading11<FONT COLOR="#000077">Starting Gopher</FONT></H3>



<P>A Gopher server can be started either from the <TT>rc</TT> startup files, from



the command line, or from the <TT>inetd</TT> daemon. From the command line or the



<TT>rc</TT> files, you need a command line similar to this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">/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.</P>



<P>The <TT>gopherd</TT> command line accepts a number of optional flags to control



its behavior, although most mirror entries in the configuration files. Valid flags



are listed here: <TT>-C</TT> Disables directory caching</P>



<P><TT>-c</TT> Runs without <TT>chroot</TT> restrictions</P>



<P><TT>-D</TT> Enables debugging</P>



<P><TT>-I</TT> <TT>inetd</TT> is used to invoke <TT>gopherd</TT></P>



<P><TT>-L</TT> Followed by a value for the maximum load average</P>



<P><TT>-l</TT> Log file to record connections (filename follows the option)</P>



<P><TT>-o</TT> Specifies an alternate configuration file from <TT>gopherd.conf</TT>



(filename follows the option)<BR>



<BR>



<TT>-u</TT> Sets the name of the owner running <TT>gopherd</TT> (valid username must



follow the option)<BR>



<BR>



To help secure your system, use <TT>chroot</TT> to create a separate file system



structure for the gopher area (as you did with FTP: see Chapter 48, &quot;FTP and



Anonymous FTP Sites&quot;). The <TT>-c</TT> option is not as secure as running <TT>gopherd</TT>



with <TT>chroot</TT> active. Also, the <TT>-u</TT> option should be used to make



<TT>gopherd</TT> run as a standard user's process, instead of as root. This helps



protect against holes in the daemon that a hacker could exploit.</P>







<P>If you want to run Gopher under <TT>inetd</TT> (started whenever a request for



the service arrives), modify the <TT>/etc/services</TT> and <TT>/etc/inetd.conf</TT>



file to include a line for Gopher. Normally, the entry in <TT>/etc/services</TT>



looks like this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">gopher     70/tcp     



</FONT></PRE>



<P>And the entry in <TT>/etc/inetd.conf</TT> looks like<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">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 <TT>gopherd</TT> as (you can set



up a specific account for <TT>gopher</TT> in /<TT>etc/passwd</TT> with standard permissions).</P>



<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:</P>



<PRE><FONT COLOR="#0066FF">telnet gopher 70



</FONT></PRE>



<P>If the connection is properly made, you will see your Gopher system on the screen.</P>



<P>Yet another alternative to test your system is to use the program <TT>gopherls</TT>,



which requires the name of the directory your Gopher source resides in. To start



<TT>gopherls</TT>, you would issue the command</P>



<PRE><FONT COLOR="#0066FF">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.



<H3 ALIGN="CENTER"><A NAME="Heading12<FONT COLOR="#000077">Letting the World



Know</FONT></H3>



<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.)</P>



<P>To have your Gopher service listed in the main Gopher service directories, send



an e-mail message to the following address:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">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



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.



<H3 ALIGN="CENTER"><A NAME="Heading13<FONT COLOR="#000077">Summary</FONT></H3>



<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. Although the configuration process can take a while, once it's completed,



the Gopher system tends to work very well.



















</td>
</tr>
</table>

<!-- begin footer information -->



</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -