gopher_site_setup_and_hosting_features
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
gopher_site_setup_and_hosting_features [2023/06/30 23:37] – [Caveat] hc9 | gopher_site_setup_and_hosting_features [2024/09/04 07:23] (current) – "'' hc9 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Gopher ====== | ||
+ | |||
+ | What is Gopher? | ||
+ | |||
+ | //From: < | ||
+ | |||
+ | > The Gopher protocol is a TCP/IP Application layer protocol designed for distributing, | ||
+ | |||
+ | You can find more info here: | ||
+ | |||
+ | * [[http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | |||
+ | ===== Viewing Gopherspace ===== | ||
+ | |||
+ | There are many ways to view gopherspace. Here are the easiest ways you can [[accessing web spaces# | ||
+ | |||
+ | Additionally, | ||
+ | | ||
+ | ===== Creating your own Gopherspace ===== | ||
+ | |||
+ | The command '' | ||
+ | |||
+ | When you run '' | ||
+ | |||
+ | HOWTO - Tips on managing your GOPHERSPACE | ||
+ | setup - First step, create your GOPHERSPACE | ||
+ | chmod - Set/Restore file permissions | ||
+ | title - Title your site | ||
+ | describe | ||
+ | mkdir | ||
+ | rmdir | ||
+ | edit | ||
+ | upload | ||
+ | ls - List the current directory | ||
+ | cd {directory} - Change directory | ||
+ | pwd - Present working directory | ||
+ | gopher | ||
+ | quit | ||
+ | |||
+ | The setup command will create a directory in your $HOME called gopher (This directory is a link to / | ||
+ | |||
+ | Once you create your Gopherspace, | ||
+ | |||
+ | ==== Viewing with mkgopher ==== | ||
+ | |||
+ | You can issue the gopher command, either from the SDF shell or from within the '' | ||
+ | |||
+ | ===== Publishing Content ===== | ||
+ | |||
+ | You can use mkgopher to publish documents, create directories, | ||
+ | |||
+ | The usual ‘mkgopher -p’ command has not yet been updated to reflect Gophernicus' | ||
+ | |||
+ | $ find ~/gopher/ -type f -print0 | xargs -0 chmod 644 | ||
+ | $ find ~/gopher/ -type d -print0 | xargs -0 chmod 755 | ||
+ | |||
+ | You may need to manually add execute permissions to any dynamic gophermaps or files under /cgi-bin after runnig these two commands. | ||
+ | |||
+ | ==== Gophermap ==== | ||
+ | |||
+ | **Note:** You can view the sample gophermap that comes with Gophernicus here: [[http:// | ||
+ | |||
+ | Say that you have file1.txt, file2.pdf, file3.rtf and dir in your Gopherspace (dir is a directory). That is, | ||
+ | |||
+ | $ ls -lF | ||
+ | drwxr-x--- | ||
+ | -rw-r----- | ||
+ | -rw-r----- | ||
+ | -rw-r----- | ||
+ | |||
+ | When you visit it, if there is no file named gophermap (yes, this file has no extension) you'll see a list of the files and the directory, like this: | ||
+ | |||
+ | ,,, | ||
+ | Gopher Menu | ||
+ | | ||
+ | (DIR) dir | ||
+ | (FILE) file1.txt | ||
+ | (FILE) file2.pdf | ||
+ | (FILE) file3.rtf | ||
+ | |||
+ | If there is a gophermap file, the server will parse it and will present the content as you specified in gophermap. | ||
+ | |||
+ | The gophermap syntax is: | ||
+ | |||
+ | XSome text here< | ||
+ | |||
+ | where the first character (X in the example) is an itemtype (more below), Some text here is the text that you want to be displayed, <TAB> is a tab character, / | ||
+ | |||
+ | The itemtype is one of these characters: | ||
+ | |||
+ | ^ Itemtype ^ Content ^ | ||
+ | | 0 | Text file | | ||
+ | | 1 | Directory | | ||
+ | | 2 | CSO name server | | ||
+ | | 3 | Error | | ||
+ | | 4 | Mac HQX filer | | ||
+ | | 5 | PC binary | | ||
+ | | 6 | UNIX uuencoded file | | ||
+ | | 7 | Search server | | ||
+ | | 8 | Telnet Session | | ||
+ | | 9 | Binary File | | ||
+ | | c | Calendar (not in 2.06) | | ||
+ | | e | Event (not in 2.06) | | ||
+ | | g | GIF image | | ||
+ | | h | HTML, Hypertext Markup Language | | ||
+ | | i | “inline” text type | | ||
+ | | s | Sound | | ||
+ | | I | Image (other than GIF) | | ||
+ | | M | MIME multipart/ | ||
+ | | T | TN3270 Session/ | | ||
+ | |||
+ | === Gophermap example === | ||
+ | |||
+ | OK, let's say that you want to display a welcome message, a description for file1.txt, file2.pdfand dir, a link to an external server, a link to an http URL. Your gophermap should be like this: | ||
+ | |||
+ | Welcome to my Gopherspace! | ||
+ | | ||
+ | 0My text file file1.txt | ||
+ | 9My pdf file file2.pdf | ||
+ | 1My dir dir | ||
+ | | ||
+ | 0Why is Gopher Still Relevant? | ||
+ | hAn http link URL: | ||
+ | |||
+ | Remember the gophermap syntax? Then be careful about tab characters. In the example above, there are some< | ||
+ | |||
+ | 0My text file< | ||
+ | |||
+ | while the seventh is | ||
+ | |||
+ | 0Why is Gopher Still Relevant?< | ||
+ | |||
+ | How come the pdf file has an itemtype 9? Well, not every kind of file has its own itemtype, so you can use one that makes more sense. | ||
+ | |||
+ | Even if you don't need a blank line as the second line of your document, you can find this useful as there is a known Lynx bug that makes it display the second line together with the first (you can find a patch for this here: gopher:// | ||
+ | |||
+ | This is (more or less) the output you'll see if you use a gophermap like the one in the example above: | ||
+ | |||
+ | ,,, | ||
+ | Gopher Menu | ||
+ | | ||
+ | | ||
+ | | ||
+ | (FILE) My text file | ||
+ | (BIN) My pdf file | ||
+ | (DIR) My dir | ||
+ | | ||
+ | (FILE) Why is Gopher Still Relevant? | ||
+ | (HTML) An http link | ||
+ | |||
+ | ===== Gopher log ===== | ||
+ | |||
+ | A gopher log (glog or phlog) is similar to a blog, but on gopherspace. You can create your phlog and add it to the [[http:// | ||
+ | |||
+ | Maintaining a glog consists basically (but not necessarily) in creating an entry (in your log directory) and modifying your phlog gophermap so that the new entry is displayed with its creation date. There' | ||
+ | |||
+ | | ||
+ | |||
+ | where the 2 arguments are self-explaining. | ||
+ | |||
+ | Say that you have two entries in your diary. If you use mkgopherentry, | ||
+ | |||
+ | <file config entries> | ||
+ | |||
+ | | ||
+ | | ||
+ | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
+ | Cras eros turpis, tristique semper aliquet sit amet, | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | First entry in my gopher log at SDF. | ||
+ | | ||
+ | |||
+ | </ | ||
+ | |||
+ | //NOTE:// You can use the ‘phlog’ command to add your phlog/glog to the gopher.club phlog listing, and you can then update the listing after you create a post by running the following command: “touch ~ftp/ | ||
+ | |||
+ | ==== Other glog/phlog software ==== | ||
+ | |||
+ | There are some software authored by SDF members that you could find useful if you want to maintain a gopher log. | ||
+ | * germ | ||
+ | * gopher:// | ||
+ | * slerm | ||
+ | * gopher:// | ||
+ | * gopher:// | ||
+ | * http:// | ||
+ | * glog | ||
+ | | ||
+ | * mkphlog | ||
+ | * gopher:// | ||
+ | * gopher:// | ||
+ | * tirph | ||
+ | * gopher:// | ||
+ | * ugo | ||
+ | * gopher:// | ||
+ | |||
+ | You can find more resources in the // | ||
+ | |||
+ | ===== Dynamic content (gopher CGIs or moles) ===== | ||
+ | |||
+ | The server used by SDF (Gophernicus) is able to serve moles. Moles are executable files under /cgi-bin that are processed by the server as CGIs. This means that you can write a script, that the server will execute and it will present the data that your mole dumps to standard output. With moles you don't have to declare a content type header. Moles get arguments from the address used to access the document and can be accessed with whatever itemtype makes sense for the kind of output the mole generates. | ||
+ | |||
+ | You can code moles with the language(s) you are comfortable and can use on SDF. Below we will see some examples using shell scripts. | ||
+ | |||
+ | ==== Mole examples ==== | ||
+ | |||
+ | Remember that your moles need to be executable (and readable) by everyone, and under /cgi-bin. So you will have to do: “chmod 755 YOURSCRIPT.cgi” | ||
+ | |||
+ | === fortune.cgi === | ||
+ | |||
+ | The following example will generate a random fortune: | ||
+ | |||
+ | #!/bin/sh | ||
+ | / | ||
+ | |||
+ | Easy enough, isn't it? As it is raw text, you can access it using am itemtype = 0, that is: gopher:// | ||
+ | |||
+ | Did you notice that fortune was called with a full path? OK, that's because the server' | ||
+ | |||
+ | === ls.cgi === | ||
+ | |||
+ | The following example will generate a list of files on a specified directory. It will be possible to sort the content alphabetically or by modification time, based on how you access the script. | ||
+ | |||
+ | < | ||
+ | |||
+ | #!/bin/sh | ||
+ | | ||
+ | directory=/ | ||
+ | rel_dir=/ | ||
+ | server=sdf.org | ||
+ | port=70 | ||
+ | | ||
+ | # The internal field separator is set to be a newline | ||
+ | IFS=' | ||
+ | ' | ||
+ | | ||
+ | if [ -n " | ||
+ | ls_arg=t | ||
+ | fi | ||
+ | | ||
+ | for i in $(ls -l${ls_arg} $directory) ; do | ||
+ | |||
+ | content=$(echo " | ||
+ | date=$(echo " | ||
+ | | ||
+ | if [ -z " | ||
+ | continue | ||
+ | fi | ||
+ | | ||
+ | if [ -d $directory/ | ||
+ | itemtype=1 | ||
+ | else | ||
+ | itemtype=0 | ||
+ | fi | ||
+ | | ||
+ | echo " | ||
+ | done | ||
+ | |||
+ | </ | ||
+ | |||
+ | Note that the echo… line is\\ “ '' | ||
+ | |||
+ | If you go to gopher:// | ||
+ | |||
+ | === figlet.cgi === | ||
+ | |||
+ | You can add some interactivity by using the itemtype 7. This itemtype is intended to make it possible to type some characters in a search field in your browser. However, you can use it to make it possible to pass arguments to your scripts. The following example will use some text you digit in the search field and will pass it through the program figlet. | ||
+ | |||
+ | #!/bin/sh | ||
+ | | ||
+ | IFS=' | ||
+ | ' | ||
+ | | ||
+ | for line in $(/ | ||
+ | echo " | ||
+ | done | ||
+ | |||
+ | When you access the script via gopher:// | ||
+ | |||
+ | The i in the echo... line is important here. Indeed, the document is been accessed with an itemtype 7 (but the same applies for itemtype 1), so the document should be structured similarly to gophermaps. It's not a gophermap, though. That's why you need to explicitily state the line should be displayed as simple (or inline) text. | ||
+ | |||
+ | ==== Caveat ==== | ||
+ | |||
+ | Besides what was said in the last paragraph of the figlet.cgi example, there' | ||
+ | |||
+ | '' | ||
+ | |||
+ | where <TAB> is a tab character (you should already know this!)C and error.host and 1 are, respectively, | ||
+ | |||
+ | ---- | ||
+ | |||
+ | Traditional link (using [[wp> | ||