---------------------------------------- | |
A lame frontend for a gopher server on FreeBSD 12, a quick & dirty howto | |
January 24th, 2019 | |
---------------------------------------- | |
Here's a quick and dirty howto guide on how to deplay a very basic, but | |
functional, web frontend to a locally hosted gopher server on FreeBSD 12. | |
This is an add-on to last phlog I posted, "Gophernicus on FreeBSD12 quick | |
/dirty HOWTO". As last time, I used VirtualBox, bridged networking, | |
and accessed the gopher server + web frontend via LAN (ipv4). Everything | |
was done as root, but gopherfilter and lighttpd run unprivileged. | |
First let us pull in a cool webserver and some dependencies: | |
#pkg install lighttpd curl lynx p5-HTML-Parser tidyp unix2dos | |
Now lets set it to automatically start on boot | |
You can do this by editing /etc/rc.conf with your favourite text editor, | |
add this line to the bottom: | |
lighttpd_enable="YES"" | |
Our gopher gateway is basically a CGI script, so lets go enable CGI now.. | |
Take a text editor to /usr/local/etc/lighttpd/modules.conf and | |
remove the comment (#) from the mod_cgi line, it should read: | |
include "conf.d/cgi.conf" | |
Also remove the comment from the "mod_alias", line too, that module is | |
required to redirect suspected gopher URLs to the CGI. | |
Now that CGI and mod_alias have been enabled, we will tell lighttpd | |
which URLs belong to the gopher gateway script, to do this we will | |
replace the /usr/local/etc/lighttpd/conf.d/cgi.conf with a prebaked | |
version which has the most common gophertypes | |
#cd /usr/local/etc/lighttpd/conf.d | |
#mv /usr/local/etc/lighttpd/conf.d/cgi.conf cgi.conf.ORIG | |
#wget http://gopher.zcrayfish.soy/0/phlog/files/cgi.conf | |
#dos2unix cgi.conf | |
Our web files will be stored at /usr/local/www/data/, so go there now and | |
we'll download the CGI script and do some quick and basic setup | |
#cd /usr/local/www/data | |
#wget https://gopher.zcrayfish.soy/0/phlog/files/gopher.sh | |
#dos2unix gopher.sh | |
#chmod a+x gopher.sh | |
#ln -s gopher.sh index.sh | |
Open gopher.sh in your editor and change the fqdn variable to your | |
hostname. | |
Open /usr/local/etc/lighttpd/lighttpd.conf in your editor and go find the | |
index-file.names section, make sure index.sh is in the list. | |
Now we have to do a workaround for a lynx bug that ruins gopher often. | |
Edit /etc/services and add a line for gopherfilter which we will run on | |
port 7070, tcp: | |
gopherfilter 7070/tcp | |
Edit /etc/inetd.conf and add a line for the gopherfilter server which we | |
will install in /usr/local/bin/gopherfilter.sh: | |
gopherfilter stream tcp nowait nobody /usr/local/bin/gopherfilter.sh | |
Now we will download and start the gopherfilter, and start the web server | |
#cd /usr/local/bin | |
#wget http://gopher.zcrayfish.soy/0/phlog/files/gopherfilter.sh | |
#dos2unix gopherfilter.sh | |
#chmod a+x gopherfilter.sh | |
#service inetd restart | |
#service lighttpd start | |
Now point a browser at your new web server IP and hope that it works! | |
Have fun! | |
---------------------------------------- | |
Back to phlog index | |
gopher.zcrayfish.soy gopher root | |
This phlog entry has been read 2935 times. | |
Future direct comment submission has been disabled for this phlog entry. | |
Comments are still accepted by email, please send to: | |
[email protected] | |
Be sure to include the post title in the subject line! Thanks! | |
Nobody has commented on this post. |