|
@@ -465,12 +465,13 @@ E.g.: `127.0.0.1:80,[::1]:80,x/tmp/sockname` will listen to localhost
|
|
|
http connections using IPv4, IPv6 and the domain socket `/tmp/sockname`.
|
|
|
|
|
|
### lua\_background\_script
|
|
|
-Experimental feature, and subject to change.
|
|
|
Run a Lua script in the background, independent from any connection.
|
|
|
The script is started before network access to the server is available.
|
|
|
It can be used to prepare the document root (e.g., update files, compress
|
|
|
files, ...), check for external resources, remove old log files, etc.
|
|
|
|
|
|
+The script can define callbacks to be notified when the server starts
|
|
|
+or stops. Furthermore, it can be used for log filtering or formatting.
|
|
|
The Lua state remains open until the server is stopped.
|
|
|
|
|
|
For a detailed descriotion of available Lua callbacks see section
|
|
@@ -1091,6 +1092,9 @@ A Lua background script may define the following functions:
|
|
|
`stop()` -- called when the server is stopped
|
|
|
`log(req, res)` -- called when an access log entry is created
|
|
|
|
|
|
+The return values of `start` and `stop` are ignored. The `start` callback can be used
|
|
|
+to create timers.
|
|
|
+
|
|
|
The optional function `log` may be used to filter or format access log file entries.
|
|
|
The `request_info` table is supplied as first argument (content of this table: see above).
|
|
|
The second argument is the request processing result. It contains the number of bytes
|