2021-09-01.txt

﻿
	Most of the commands can be copied from the install file and pasted to a terminal. A few things will need to be changed but most will be: copy, paste, enter. WWW pages for EVERYONE!!!

**************

	To make the "thttpd" install easy enough a third or fourth grader should have no problems, I copied the "thttpd" pages from "Acme.com" and put them in that directory. There is a lot of information on those pages and one should at least look at them. I have been running "thttpd" on my web site, http://162.250.19.7/ since 2019.07.29 without any problems. I have found the Raspberry Pi 400 is very capable of running Ubuntu 64 bit Desktop	arm64+raspi as a full desktop computer as well as running thttpd as a 24 hour 7 days a week web server. This computer usually runs well under 10 watts, and uses a 15 watt (3 amps @ 5 volts) power supply that has power to spare. When just the web server is needed, one can just turn off the HDMI monitor, and everything just keeps running! With a heat sink instead of a fan the unit is silent! Since the whole kit is only $100 USD it makes for a fantastic computer and web server all in one.
	
**************

	How much HTML do I have to know to set up a web page? NONE!
	The thttpd web server, without any HTML, can make a quick and dirty website which looks like a directory listing. The priority is FUNCTION and GLITZ can come later! I have included Acme.com's "HTML Sampler.html" for those who are not familiar with "HTML". Acme.com also has many more programs and ideas, and is worth checking out!
	If you get banned by Google, Facebook, YouTube or whoever, you can be back live in minutes! When a file is put into "public_html" it is live!
	These instructions may seem long with a lot of unnecessary text, but I want even a third or fourth grader who has never compiled a program to be able to go through the process without any trouble. If they do have trouble, with enough documentation to be able to see where they went wrong and be able to correct the problem.
	This project should be the beginning for a live stable website directly connected to the Internet, whether connected dynamically or statically, and as a basis for website design. Out of the box, it is read-only and therefore "Bullet Proof". I have been totally impressed with "thttpd" which used to be the number seven most popular web server, running such sites as: 
    demon.net, Demon Internet, a large UK ISP
    global.net.uk, Global Internet, another large UK ISP
    bluelight.com, Kmart's web site
    img.gamespot.com, GameSpot's image server
    download.napster.com, Napster's download server
    stephenking.com, Stephen King's official site
    mtv.com, It's not TV, it's eMpTV.
    news.excite.com, one of Excite's internal servers
    valueclick.com, a banner ad broker
    sealandgov.com, The Sovereign Principality of Sealand
    The Drudge Report
    garfield.com, the comic strip
    images.paypal.com.

thttpd - tiny/turbo/throttling HTTP server

IPv6 ready.

thttpd is a simple, small, portable, fast, and secure HTTP server.

Simple:
    It handles only the minimum necessary to implement HTTP/1.1. Well, maybe a little more than the minimum. 
Small:
    See the comparison chart. It also has a very small run-time size, since it does not fork and is very careful about memory allocation. 
Portable:
    It compiles cleanly on most any Unix-like OS, specifically including FreeBSD, SunOS 4, Solaris 2, BSD/OS, Linux, OSF. 
Fast:
    In typical use it's about as fast as the best full-featured servers (Apache, NCSA, Netscape). Under extreme load it's much faster. 
Secure:
    It goes to great lengths to protect the web server machine against attacks and breakins from other sites. 

It also has one extremely useful feature (URL-traffic-based throttling) that no other server currently has. Plus, it supports IPv6 out of the box, no patching required.

Look in the directory "Acme.com" for more information on "thttpd" and go to their website "Acme.com" for more programs and ideas!

*********

	The initial file for a web page is "index.html" although thttpd will recognize INDEX_NAMES: "index.html", "index.htm", "index.xhtml", "index.xht", "Default.htm", and "index.cgi", for initial web page file names. If no index file is found, thttpd will automatically generate its own index which results in a green screen and a directory listing.

	For starters, one should probably choose a microSD card that has a U3 rating (100MB/s Read speed, and 50MB/s Write speed) over a U1 card (100 MB/s Read speed, and 10 MB/s Write speed). I have been using WalMart "keep onn" cards which work OK. One 128GB microSDXC U3 Card with Adapter runs $17.94, One 64GB microSDXC U3 Card with adapter runs $11.24, while two 32GB microSDHC U1 Cards with Adapter runs $11.94. At present, my website, http://162.250.19.7/ was running on a Raspberry Pi 4B with 4GB RAM and a 32GB U1 card using 32 bit Raspian which runs OK. 2021-06-17 I moved to Ubuntu-64-21-04 on a 64GB U3 card with less than 14 minutes of down time. When moving linux files don't expect the owner and groups to match since linux uses the number for both of these areas! That was a real challenge! I used "copy and paste" from the install file to the command line for almost all of the data entry, except for the few items that needed to be changed. My biggest problem is losing power since I live out in my field and have to run batteries and an inverter for my power. If my voltage goes too high it drops out, and if it goes too low it drops out. My internet connection is from https://RiverCanyonWireless.com/ and is $30 a month with an extra $5 for a static IP Address, with a download speed of 2Mbits/sec and an upload speed of 1Mbits/sec. thttpd will serve files up to 2GB and if they are over that they just don't show up. Downloading "Ubuntu 21.04 Desktop 64bit" at 1.6GB took 2 hours. A 2GB file uploading would take up all of my bandwidth for at least 5 hours! Smaller files work a lot better! thttpd is a bullet proof World Wide Web HTTP server which used to be the number seven most popular web server. One can safely post things for the "World to See" since out of the box thttpd has a read only file structure. My site has been up for over 2 years with no problems, and I had no problems when I ran an earlier version back in 2005. Some of my earlier sites are under "www/" and are not that great, but making a website with HTML is a learning process. As one can see from my site, the idea is to share information with someone across the world, (Function) and worry about the (Glitz) that can come with experience. If one would like to see what kind of hammering a www site gets they can look at my log files under "ac0xl/" and then "logs/" which I have been posting manually. Using "whois"  and typing in their IP Address, (sudo apt install whois), one can get an idea of where someone was coming from when they looked at your site. I really liked the use of an anvil for an icon since it denotes the ability to be hammered on without breaking!

	If one is going to use a microSD card that is larger than 32GB one HAS to erase it first with rpi-imager (To install on Raspberry Pi OS, type: "sudo apt install rpi-imager", in a Terminal window.) The message I got back was: No apt package "rpi-imager", but there is a snap with that name. Try "snap install rpi-imager" which did actually work! Under Operating System, choose "ERASE, Format card as FAT32", since the loader will only handle a FAT32 file system, and then after it loads it will replace all of that with a FAT32 boot partition and a regular 83 linux ext4 rootfs partition.

	The next step is to copy the 64 bit Ubuntu Desktop OS onto the microSD card. It really helps to have a USB card reader dongle to be able to write to SD and microSD cards! After the card is written it is time to shut down and power off, then install the new microSD card into the Pi 400 and repower it. The setup process will take a little time, and then ask some questions to get the system up and running. After it finishes with the setup, go into the Firefox Web Browser and at the top click on the 3 bars at the top right (Open Application Menu). Under Preferences, Files and Applications, click on "Always ask you where to save files" as we will be saving files to several different places. It would probably be a good idea to also go through all of the different settings and get them the way you want. Another place to check to get things to where one can see them is the top right hand corner where the power and internet connections show and click on it, then click on "Settings." Under Accessibility, I turned on "Large Text" and on the Cursor Size I went with "Larger" so I could see where the mouse pointer was. The question on a new system is always, "Where did they hide this function?" At this point I think we are ready to start getting "thttpd" and the documentation loaded. Thank You! http://Acme.com/ for your awesome software!

frank@frank-desktop:/etc$ 
frank@frank-desktop:/etc$ less services		# This will show a listing of service ports.
...
	(This file has a list of "Ports" that are in use. The default "HTTP port is 80.") thttpd's default port is 80, port numbers are 16-bit so can range from 1 - 65536. Only one service can use a port number at a time, thus we see that my Raspberry Pi web server will give the same information on all of the IPv4 addresses that are attached to it, i.e., eth0, and wlan0 with its different IP addresses both connected to the same http port 80. In a classroom situation, more than 200 students can be connected to the same "C" class network (192.168.xxx.0/24) and can each connect to each other's web servers, where xxx is the same for all, and the 0 position can very from 2 - 254, with 0 representing the network, 255 is reserved for the broadcast address, and 1 reserved for the router address. With the router set up as a “DHCP Server” all of the computers would receive dynamic IP addresses and all of their http websites would be available in the addresses they were assigned. The http port number (80) is assigned by the computers and the IP addresses are assigned from the router.
	The router separates the “Local Area Network” (LAN) from the “Wide Area Network” (WAN). Just as the HTTP default address is port 80 and is static, the router has to have the internal IP address for our website “static” so it can pass information back and forth from our internal web server to the external Internet. In the file “2019-10-01-website.txt” I discuss the process of setting the internal web server to a static internal IP address.
	In the router, under the “Advanced” tab, select “Virtual Server”, and it should display a message similar to: “This page allows you to configure a virtual server, so others can access the server through the Gateway.” This will probably very with different routers so one might have to search a bit to find the similar place. The “usual Service Name” should have a selection of something like “web” or “http” and choose this. It should then show the “Protocol” as “TCP”, “WAN Port” as “80”, and “LAN Open Port” as “80”. In the “LAN IP Address” type in the static internal IP address of your web server, and press, “Apply Changes”.  This should fill in a table in “Current Virtual Server Forwarding Table” with “ServerName - WEB”, “Protocol - tcp”, “Local IP Address - 192.168.x.2” i.e., your internal IP address, “Local Port - 80-80”, “WAN Port - 80-80”, “State - Enable”, and possibly “Action either Delete or Disable”.
	With this enabled, your website should be available to the WAN. Since your ISP is providing your external IP address, it doesn’t matter if it is dynamic or static. Until you get an idea of the activity that is taking place on the web, it would probably be good just to have a dynamic address if that is what you have. If you are in an area of extreme censorship, it will make the censorship game more of a “Cat and Mouse” game since your site could be bouncing around all sorts of different IP addresses. “Free Speech for the WORLD!”

	Another reason we use "/home" user directories in the "www" group is to be able to keep all of our original web files there and then just send a copy to the "public_html" directory where it is instantly live. This also reduces the size of our web site by eliminating the bloat of having original files mixed in with our files needed for the web site. It will also reduce the time it will take for the Web Search "spiders" to see what content is available on our sites. When we use "HTML" code for our web pages, the root of the page will be in "index.html" and then the items listed in this file can be in the same directory or in sub directories. If you have a lot of "images" on your web page, you would probably want to put all of them in a sub-directory called, "images" just to keep similar things together and easier to find. To test your "index.html" file, you just open it with a web browser and see if everything is functioning. Then when everything is OK, just move your changes and additions to "public_html" and then open your web browser to "http://xxx.xxx.xxx.xxx/" and see if everything is working. Most web browsers keep a copy of your pages in cache so if the changes don't appear you will have to refresh your web page (usually the little circle with an arrow on it). If the changes still don't appear, possibly you forgot to move the changes to "public_html". Just a reminder, all of the directories in "public_html" need to be "0755" to work and files need to be "0644" to work. If you get to the point of using "cgi" programs they will also need to be "0755" so they can execute, and also need to have the right ending on those files, the documentation for "thttpd" talks about all of this. Sometimes I even need to use "0754" if it is a program type file that should be readable. 

*****************************

Setting the router for World Wide Web service


	It took me a long time to finally figure out how to set up the router so most people could do it without too much trouble. My routers are old so will be different than newer ones, but I will go through three routers that I have and that might help.
	
#1:
	D-Link GO-RT-N300, 12VDC @ 0.5 Amps. Out of the box, it's address is: 192.168.0.1 but I set mine to: 192.168.19.1, just so it would have less trouble with neighboring routers. In the setup page, under "Local Network" and on "DHCP Server Settings" I selected my IP Pool Range from 192.168.19.10 to 192.168.19.254, that blocked the section of addresses of 192.168.19.2 through 192.168.19.9 so I could use them for static IP Addresses, and used 192.168.19.2 for my web server.
	The next header "DHCP Static IP Configuration" has: 
	
IP Address: 	0.0.0.0
Mac Address:  000000000000 	(ex. 00E086710502)
	
followed with selections: Add, Update, Delete Selection, and Reset.

	The next header "DHCP Static IP Table"
		
Select  IP Address         MAC Address
  ()    192.168.19.2    DC:A6:32:19:95:B9
  
	As I remember it would say that "192.168.19.2" was not in the pool, but I think I managed to get it to accept it by clicking the Select and then the update choice.
		
	Click on the top header "Advanced" and then at the bottom of the list "Virtual Server". On this page, the box will list "Virtual Service Name" and the choice that is right is "WEB" which will bring up "WEB" Protocol "TCP" WAN Port "80" LAN Port "80" LAN IP Address "xxx.xxx.xxx.xxx" (actually no xxx's) but is where you enter the IP Address of your web server. Then click "apply changes" (Since ) The header below is: 
	"Current Virtual Server Forwarding Table"
	 
ServerName 	Protocol    Local IP Address    Local Port 	WAN Port    State        Action
    WEB       tcp         192.168.19.2 	      80-80      80-80 	    Enable 	 Delete Disable

#2:
	Zonet1), ZSR4154WE(01), 802.11n Wireless Broadband Router, Power: 9V-1A, IP Address: 192.168.0.1
On "192.168.0.1/main.html", Select "Virtual Server", then "Port Range Forwarding", and under "Well Known Service Ports", select "HTTP(80) and then "ADD" (1-10) for possible selections. This populates the selected line with: "Start Port - End Port" with "80 - 80", "To IP Address" "192.168.0.""100", "Protocol", "TCP", "Enable", "checked". Then click "Apply", and "Logout".

#3:
	Western Digital My Net N750, 12 VDC @ 2 Amps, Tabs: Additional Features / Port Forwarding

Port Forwarding

This option is used to open multiple ports or a range of ports in your router and redirect data through those ports to a single computer on your network. This feature allows you to enter external start port, external end port, and internal start port in the fields. The internal end port will be generated automatically. This option is only applicable to the Internet session.

Enabled 	Name: HTTP		Application Name: HTTP		External Port Range	From: 80	To: 80	Protocol	TCP

IP Address: 192.168.1.138	Computer Name: frank-desktop (102.168.1.138)	Internal Port Range	From: 80	To: 80

	Then "SAVE".
	
	This pretty much automates the process. One would need to set a static IP address on the web server machine so it would always be at the same address.

*****************************

	Links:
	These links are the easiest and best I have found for sharing the “Good News” I found around my seventh birthday, the Fall of 1955. Frank Anderson, ac0xl.
http://4laws.com/laws/languages.html, 4 Spiritual Laws.
https://www.cru.org/us/en/train-and-grow/spiritual-growth/the-spirit-filled-life.html, The Spirit Filled Life.
https://www.cru.org, Exploring Your Life’s Purpose - Let’s journey together.
https://godtoolsapp.com, GodTools - Helping You Share Your Faith.
#

