children = {}
root = sys.argv[1]
+
+# Automatically reap all children that die for any reason.
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
def serve(req):
#!/bin/sh
+# Change to the directory containing this script
set -e
cd "$(dirname "$0")"
+# Start htparser running this dynhosts script. The setsid command
+# ensures that SIGINT is only received by htparser and not by
+# dynhosts; it is not of grave importance, but makes shutdown slightly
+# more clean, and hides the KeyboardInterrupt otherwise raised by
+# Python.
htparser plain:port=8080 -- setsid ./dynhosts .
#!/bin/sh
+# Change to the directory containing this script
set -e
cd "$(dirname "$0")"
+# Simply invoke htparser running dirplex in this directory
htparser plain:port=8080 -- dirplex .
-child default
- exec dirplex default-site
+# Sample virtual host configuration. See the patplex(1) manual page
+# for further details on the configuration format.
+
+match
+ # Match localhost specifically. Note that the Host header may
+ # include a port specification, which is optionally matched by the
+ # end of the regex.
+ header host ^localhost(:[0-9]+)?$ i
+ handler localhost
child localhost
+ # The child specification called when the localhost pattern
+ # matches. Simply run dirplex(1) in the subdirectory `localhost'.
exec dirplex localhost
match
+ # Catch-all pattern for all requests not specifically directed at
+ # localhost.
default
handler default
-match
- header host localhost(:[0-9]+)?$ i
- handler localhost
+child default
+ exec dirplex default-site
#!/bin/sh
+# Change to the directory containing this script
set -e
cd "$(dirname "$0")"
+# Start htparser running patplex; see the patterns.conf file for
+# further details.
htparser plain:port=8080 -- patplex patterns.conf