nginx的模块
upstream-keepalive-nginx-module-0.3
在openresty里面保函,长连接的。很有用哦
注意那个echo命令
看那个变量不认识就打印出来吧
在mac下
echo-nginx-module里面有echo等
nginx_hello_world是自己写的,
ngx_devel_kit是set-misc-nginx的以来
set-misc-nginx是设置参数的set_unescape_uri等
./configure \ --with-debug \ --prefix=/Users/apple/Desktop/myfile/nginxtest/nginx \ --add-module=/Users/apple/Desktop/myfile/nginxtest/echo-nginx-module-0.37rc7/ \ --add-module=/Users/apple/Desktop/myfile/nginxtest/nginx_hello_world/ \ --add-module=/Users/apple/Desktop/myfile/nginxtest/ngx_devel_kit-0.2.17/ \ --add-module=/Users/apple/Desktop/myfile/nginxtest/set-misc-nginx-module-0.22rc3/ \ --with-cc-opt="-Wno-deprecated-declarations"
效果
sh-3.2# curl http://localhost/testurl
hello anonymous!
sh-3.2# curl http://localhost/testurl?persion=heihei
hello heihei!
sh-3.2#
配置文件为:
location /hello { hello_world; } # location /foo { # set $a hello; # echo_exec /bar; # } # # location /bar { # echo "a = [$a]"; # } location /foo { set $a hello; rewrite ^ /bar; } location /bar { echo "a = [$a]"; } location /testurl { set_unescape_uri $persion $arg_persion; set_if_empty $persion 'anonymous'; echo 'hello $persion!'; } location /merge { echo '['; echo_location_async /moon; echo ','; echo_location_async /earth; echo ']'; } location /moon { echo '"moon"'; } location /earth { echo '"earth"'; }
注意使用$arg_persion,就是url后面的参数persion
curl http://localhost/testurl?persion=haha
curl http://localhost/merge
用ab压
sh-3.2# ab -n 1 http://localhost:80/testurl
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)...apr_socket_recv: Connection refused (61)
是因为没起httpd
蛋疼ab不能直接用?
httpd
之后
还要ulimit -a
看看open file是否够
如果不够 ulimit -n 10240
安装http_load:http://www.acme.com/software/http_load/
http_load
-P 并发用户的进程数
-f 总计的访问次数
-r 每秒的访问次数
-s 总计的访问时间
url是一个文件
里面存 http://localhost/testurl
http_load -rate 10 -second 3 url