wm: doc

Download patch

ref: 581bb4edf342d41e13610c5761e1b5f73c4bd95b
parent: 0c75dd8ccc21d4409013536e6bde2a12a7a3493f
author: jrmu <jrmu@cloud9p.org>
date: Mon Sep 23 17:40:35 EDT 2024

Add comments for each step

--- a/rc-httpd.ms
+++ b/rc-httpd.ms
@@ -1,5 +1,16 @@
+This guide explains how to provide a simple setup for rc-httpd to serve
+static web pages.
+
+First, copy the template for tcp80 from /bin/service/!tcp80:
+
 cpu% cp (/bin/service/)^(!tcp80 tcp80)
+
+Next, create the FS_ROOT, the directory which is used to serve web documents:
+
 cpu% mkdir -p /usr/$user/www/example.com
+
+Add some files:
+
 cpu% echo "Hello, world!" > /usr/$user/www/example.com/index.html
 
 Put this in /rc/bin/rc-httpd/select-handler:
@@ -11,24 +22,27 @@
 }
 cpu% chmod +x /rc/bin/rc-httpd/select-handler
 
+This tells rc-httpd to serve static files or an index file upon web requests
+with the proper FS_ROOT.
 
-To have TLS:
+To support TLS:
 
 cpu% cp (/bin/service/)^(!tcp80 tcp443)
 
-Inside /bin/service/tcp443:
+Inside /bin/service/tcp443, we put:
 
 #!/bin/rc
 exec tlssrv -c /sys/lib/tls/acmed/example.com.crt -r`{cat $3/remote} /rc/bin/rc-httpd/rc-httpd >>[2]/sys/log/www
 
-chmod +x /bin/service/tcp443
+cpu% chmod +x /bin/service/tcp443
 
-Stick the private key into secstore's factotum:
+Make sure to store the private key into secstore's factotum, so that
+it gets loaded automatically upon boot:
 
 cpu% ramfs -p; cd /tmp
-% auth/secstore -g factotum
+cpu% auth/secstore -g factotum
 secstore password:
-% cat /sys/lib/tls/acmed/example.com.key >> factotum
-% auth/secstore -v -p factotum
+cpu% cat /sys/lib/tls/acmed/example.com.key >> factotum
+cpu% auth/secstore -v -p factotum
 secstore password:
-% read -m factotum > /mnt/factotum/ctl
+cpu% read -m factotum > /mnt/factotum/ctl