added docs for the cml.power-magnet and fixed typos

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@906 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.11
Jan Kneschke 18 years ago
parent f6257d9118
commit f3e3fc8007

@ -156,6 +156,53 @@ The index.cml for this looks like: ::
Now we get about 10000 req/s instead of 600 req/s.
Power Magnet
------------
Next to all the features about Cache Decisions CML can do more. Starting
with lighttpd 1.4.9 a power-magnet was added which attracts each request
and allows you to manipulate the request for your needs.
We want to display a maintainance page by putting a file in a specified
place:
We enable the power magnet: ::
cml.power-magnet = "/home/www/power-magnet.cml"
and create /home/www/power-magnet.cml with: ::
dr = request["DOCUMENT_ROOT"]
if file_isreg(dr .. 'maintainance.html') then
output_include = { 'maintainance.html' }
return CACHE_HIT
end
return CACHE_MISS
For each requested file the /home/www/power-magnet.cml is executed which
checks if maintainance.html exists in the docroot and displays it
instead of handling the usual request.
Another example, create thumbnail for requested image and serve it instead
of sending the big image: ::
## image-url is /album/baltic_winter_2005.jpg
## no params -> 640x480 is served
## /album/baltic_winter_2005.jpg/orig for full size
## /album/baltic_winter_2005.jpg/thumb for thumbnail
dr = request["DOCUMENT_ROOT"]
sn = request["SCRIPT_NAME"]
## to be continued :) ...
trigger_handler = '/gen_image.php'
return CACHE_MISS
Installation
============
@ -176,6 +223,8 @@ Options
hosts for the memcache.* functions
:cml.memcache-namespace:
(not used yet)
:cml.power-magnet:
a cml file that is executed for each request
Language
========
@ -206,7 +255,7 @@ Additionally to the functions provided by lua mod_cml provides: ::
boolean memcache_exists(string)
What ever your script does, it has to return either 0 or 1 for ``cache-hit`` or ``cache-miss``.
What ever your script does, it has to return either CACHE_HIT or CACHE_MISS.
It case a error occures check the error-log, the user will get a error 500. If you don't like
the standard error-page use ``server.errorfile-prefix``.

@ -6,22 +6,22 @@ SPAWNFCGI="/home/weigon/projects/spawn-fcgi/src/spawn-fcgi"
## ABSOLUTE path to the PHP binary
FCGIPROGRAM="/usr/local/bin/php"
## bind to tcp-port on localhost
## TCP port to which to bind on localhost
FCGIPORT="1026"
## number of PHP childs to spawn
## number of PHP children to spawn
PHP_FCGI_CHILDREN=10
## number of request server by a single php-process until is will be restarted
## maximum number of requests a single PHP process can serve before it is restarted
PHP_FCGI_MAX_REQUESTS=1000
## IP adresses where PHP should access server connections from
## IP addresses from which PHP should access server connections
FCGI_WEB_SERVER_ADDRS="127.0.0.1,192.168.2.10"
# allowed environment variables sperated by spaces
# allowed environment variables, separated by spaces
ALLOWED_ENV="ORACLE_HOME PATH USER"
## if this script is run as root switch to the following user
## if this script is run as root, switch to the following user
USERID=wwwrun
GROUPID=wwwrun
@ -50,5 +50,5 @@ for i in $ALLOWED_ENV; do
E="$E $i=${!i}"
done
# clean environment and set up a new one
# clean the environment and set up a new one
env - $E $EX

Loading…
Cancel
Save