ref: f552e6b0b45aad9f5ca62cef708dc0a591e88b1b
dir: /README.md/
# To run the shithub software: ```/rc/bin/service/tcp80```: ``` #!/bin/rc bind /usr/web /mnt/static exec /bin/tcp80 -r /sys/lib/tcp80 >>[2]/sys/log/httpd/log ``` ```/rc/bin/service/tcp443```: ``` #!/bin/rc bind /usr/web /mnt/static exec tlssrv -c/sys/lib/tls/cert.pem -lhttpd -r`{cat $3/remote} /bin/tcp80 -r /sys/lib/tcp80 >>[2]/sys/log/httpd/log ``` ```/lib/namespace.httpd```: ``` bind /mnt/static /usr/web/static ``` It is possible to redirect error pages by passing ```-e error```, like ```tcp80 -e 404 -e 403```. This will send a ```301 Moved Permanently``` to e.g. ```/404``` or ```/403```. It will also append the path to it: Attempting to access ```http://server/nopage.html``` would redirect to ```http://server/404/nopage.html```. It is also possible to define a set of hostnames to change the bind mounts for ```/usr/web``` based on the Host header. To use this feature, you pass ```-h file``` to tcp80. The format of the file is the same as that for execfs, a regex for the hostname, any number of tabs, with a path to be mounted over ```/usr/web```. ``` server1.domain.com /usr/webroot/server1 aardvark.different.org /usr/webroot/aardvark ``` This does not affect execfs scripts directly, although the bind mounts happen prior to their execution. If you are using the same scripts for multiple hostnames, you can check the environment using ```ns``` to find out what is mounted over ```/usr/web```. If you are using shithub, or anything similar which hooks on ```/index.html```, it will still take precedence over any static files. You can work around this by not hooking ```/index.html```, instead hook something like ```/shithub.html``` and then redirect to it.