post_action vs error_page seems doesn't work [maxf3r]
massimo ferrari
massimo.ferrari at gmail.com
Tue Mar 1 00:47:21 MSK 2011
hi,
what I want to do is:
1) trying to serve content like url =>
http://my.domain.tld/static/bla-bla-bla?id=12345
2) check an html page on cache (on redis)
3) if doesn't exists, let's create it (via php script
/api/entrypoint.php?... )
4) always update statistical counters (asyncronous batch)
problem:
step 4) never processed until I comment "error page 404 = ...".
In thi case all request to redis are processed (via 127.0.0.1:33333 and
127.0.0.1:22222) but a 404 error on browser too :(
my nginx.conf
location ^~ /static/ {
# 2) check an html page (on redis)
set $redis_key "my:permalink:$arg_id:html";
redis_pass 127.0.0.1:33333;
# 3) if doesn't exists, let's create it (via php)
error_page 404 = /api/entrypoint.php?action=do_html&id=$arg_id;
# 4) always update statistical counters (asyncronous batch)
post_action /update_counters;
}
location /update_counters {
set $queue_name 'my:queue:to:process:asyncronous';
redis2_query lpush $queue_name $request_uri;
redis2_pass 127.0.0.1:22222;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
thanks
maxf3r
--
.. happiness only real when shared [supertramp]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110228/ccf52a6a/attachment.html>
More information about the nginx
mailing list