alibaba / tengine Goto Github PK
View Code? Open in Web Editor NEWA distribution of Nginx with some advanced features
Home Page: https://tengine.taobao.org
License: BSD 2-Clause "Simplified" License
A distribution of Nginx with some advanced features
Home Page: https://tengine.taobao.org
License: BSD 2-Clause "Simplified" License
tengine limit_conn module and limit_req module needs to be able to be used simultaneously. You can specify the number of connections each ip whitelist function
Code in src/http/ngx_http_upstream.c:1638 should be changed as follows:
u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE
最近下载了tengine来测试,但是发现在ipv6这里出问题了
在nginx下,是可以使用listen [2001:470:17:12d2::2]:80 的,并且通过测试
在tengine我就得到 [emerg] the INET6 sockets are not supported on this platform in "[2001:470:18:12d7::2]:80" of the "listen"
这是为啥呢。。。
fastcgi_param REDIRECT_STATUS 200;
try_files $fastcgi_script_name =404;
所有都重定向为200状态了?
这是Nginx的问题还是PHP的问题?
Hello all.
I have a problem. You know - browsers are not so clever. If you write a link with . at the end (ex github.com.) you'll have problems. It can be...anything. Not working cookie, missed link, e.t.c. Nginx (and Tengine) corrects $host and remove bugs from it. So when i try to use return 301 or rewrite it don't works. Because configs don't see '.' at the end.
My please is to do a config value:
correct_uri_path on/off;
Thanks in advance,
Alex.
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I src/proc -I objs -I src/http -I src/http/modules
-o objs/src/http/modules/ngx_http_log_module.o
src/http/modules/ngx_http_log_module.c
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I src/proc -I objs -I src/http -I src/http/modules
-o objs/src/http/ngx_http_request_body.o
src/http/ngx_http_request_body.c
src/http/ngx_http_request_body.c: 在函数‘ngx_http_read_non_buffered_client_request_body’中:
src/http/ngx_http_request_body.c:517:32: 错误: 变量‘clcf’被设定但未被使用 [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[1]: *** [objs/src/http/ngx_http_request_body.o] 错误 1
make[1]:正在离开目录 `/data/soft/tengine-1.5.0'
make: *** [build] 错误 2
passenger是手动装的。
/etc/nginx
configuring additional modules
adding module in /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.27
/usr/share/nginx/sbin/dso_tool: error: no /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.27/config was found
root@ip-10-0-1-78:/etc/nginx# /usr/share/nginx/sbin/dso_tool -a=/usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.27 -s=/var/src/tengine-1.5.2 -d=/etc/nginx/modules/
root@ip-10-0-1-78:/etc/nginx# passenger-config --root
/usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.27
Engine Yard 早就有 patch, 不過由於非官方,所以不多人用
如果 tengine 內含就真是十分好的
what's going on?
希望实现的目标,类似PHP或Python之类的包管理,比如:yum install tengine 就是安装一个基础版的Tengine,yum install tengine-redis2 就是给Tengine增加Redis模块。
遇到的问题:
1、dso 里的 include 不支持通配符,不方便进行RPM包的拆装、必须改主配置。
2、RPM管理规则里,同一个文件不能同时属于两个软件包。如果模块的安装或修改必须修改主配置文件的话,就无法实现模块独立维护,不易运维。
location / {
trim on;
trim_jscss on;
}
还需要做其他的配置吗?
Hi
I would like to use tengine as a front-end to several solr servers, and the AJP cping check feature is really handy for this task, but the problem is that I have lots of SOLR cores in the same physical server so I have the same "server IP:PORT" config line repeated in dozens of upstreams. And for EVERY server, tengine send a cping (and expect a cpong), generating unnecessary traffic. Could you please aggregate the hosts to check based on the server's IP:PORT ? If the server is down, then mark it down in every upstream it appears.
Thanks!
编译参数:
./configure --without-dso --with-jemalloc --user=www-data --group=www-data --with-http_concat_module --with-http_sysguard_module --with-http_ssl_module --with-http_realip_module
错误信息:
src/core/nginx.c:172:5: error: ‘NGX_DSO_ABI_COMPATIBILITY’ undeclared here (not in a function)
系统 debian 7 i386
只要加了 --without-dso 编译就不通过
同样在ub13.04下,git了最新的代码,加入lua模块后报错:
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -DNDK_SET_VAR -I src/core -I src/event -I src/event/modules -I src/os/unix -I src/proc -I src/http/modules/lua/api -I /usr/include/lua5.1 -I objs -I src/http -I src/http/modules
-o objs/src/http/modules/lua/ngx_http_lua_util.o
src/http/modules/lua/ngx_http_lua_util.c
src/http/modules/lua/ngx_http_lua_util.c: 在函数‘ngx_http_lua_run_thread’中:
src/http/modules/lua/ngx_http_lua_util.c:971:34: 错误: 实参‘nret’可能为‘longjmp’或‘vfork’所篡改 [-Werror=clobbered]
cc1: all warnings being treated as errors
make[1]: *** [objs/src/http/modules/lua/ngx_http_lua_util.o] 错误 1
make[1]:正在离开目录 `/data/soft/tengine'
make: *** [build] 错误 2
Hi yaoweibin! I have been playing with tengine for the last 48 hours as a syslog-abled nginx, after rsyslog's imfile proved to be generating way too many duplicate, triplicate and at times 50-cate log lines.
the only thing missing is the rsyslog's ability to use "tags" to create a detailed log taxonomy beyond just the standard facilities. I produce an error log and three different access logs from my backend API server (based on uri prefix) in with different CSV columns for different statistics gathering. With tengine I was able to give each one a different "ident" but it does not translate to a different rsyslog tag, only adds it to the beginning of the line and wracks my csv logformat. does this have a patch?
本来是报到 nginx-http-concat这块,感觉可能没人回,就报到这来了,抱歉了。
nginx 的版本:
mactekiMacBook-Pro-3:~ mac$ nginx -V nginx version: nginx/1.5.7 built by clang 4.2 (clang-425.0.28) (based on LLVM 3.2svn) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --http-proxy-temp-path=/var/nginx/proxy --http-fastcgi-temp-path=/var/nginx/fastcgi --http-client-body-temp-path=/var/nginx/client --add-module=nginx-http-concat
nginx.conf设置:
location /sea-modules/ {
concat on;
concat_max_files 20;
}
文件目录就是html-->index+sea-modules
浏览器报错提示:
Request URL:http://localhost/sea-modules/arale/??class/1.1.0/class.js,events/1.1.0/events.js Request Method:GET Status Code:400 Bad Request
紧急求助,还望各位大牛能帮我解答一下
I compiled tengine with the headers-more module from agentzh and regular 'more_set_headers' directives work but those with mime-type of the form "more_set_headers -t 'text/html' 'X-Blah: blah blah' are not set by the module. I have move the module to the top of those compiled but still no joy. Simply removing the "-t 'text/html'" from the directive works.
We need set the request limit for HTTPS requests. the best control is when QPS reached the limitation, blocking the TCP connection. since currently there is an only http limit configuration, but the resource usage of ssl session initilation is not trival. so please add this feature.
thanks a lot.
Tengine 2.0的ngx_http_upstream_check_module如果后台是weblogic 11g,会经常出现错误。错误提示如下:
2014/01/13 14:37:36 [error] 17793#0: http parse status line error with peer: 210.xxx.xx.145:8089
2014/01/13 14:37:36 [error] 17793#0: check protocol http error with peer: 210.xxx.xx.145:8089
错误表现是:每检查几次成功后就出现1、2次错误,生成很多错误提示。如果后台是jbss4.2就没有这种错误。
后来我退回Tengine 1.52就正常了,没再出现错误,麻烦检查一下是否有bug!
配置文件如下:
check interval=2000 rise=2 fall=3 timeout=30000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
[root@bgp176-148 nginx-tests]# TEST_NGINX_BINARY=/home/wangbin/work/tengine/objs/nginx TEST_NGINX_LEAVE=1 prove nginx-tests/http_server_name.t
nginx-tests/http_server_name....nginx: [emerg] pcre_compile() failed: support for \P, \p, and \X has not been compiled in "^(?Pwww\p{N}+).example.com$" at "p{N}+).example.com$" in /tmp/nginx-test-lFnGTu9KdQ/nginx.conf:67
Can't start nginx at lib/Test/Nginx.pm line 177.
Looks like your test exited with 2 before it could output anything.
nginx-tests/http_server_name....dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-9
Failed 9/9 tests, 0.00% okay
如果HTML以注释开头,形如:
<!-- xxx -->
<html>
hi~
</html>
通过trim输出以后页面头上会留下一个多余的换行,当注释不在html最前面的时候此问题不存在。
Tested Under: v1.5.1
意外发现的,来报个Issue~
新版1.5.0按照1.4.5的相同配置,configure能成功,编译的时候提示错误:
src/http/ngx_http_request_body.c:517:32: error: variable ‘clcf’ set but not used [-Werror=unused-but-set-variable]
编译参数是:
./configure --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-ipv6 --with-mail --with-mail_ssl_module
机器是debian7.0 i386
是ngx_http_read_non_buffered_client_request_body这个新增的模块的参数问题?
Can git-mirror/nginx@fab658f be merged into tengine mainline?
Current nginx version does not support the math comparison,such as :
set $a 1;
set $b 2;
if ( $a < $b ) {
echo "a is less than b";
}
this configure will cause the error while restarting nginx because current nginx/tengine does not support the math comparison.
but if you accomplish this function that is great for every tengine's user.
*.note: before the $a comparing with $b,they should be tonumber() to a number not a string.
:)
Cannot compile at gcc version: 4.7.2 (Debian 4.7.2-5)
./configure --with-cc-opt=-O3 && make
src/http/ngx_http_request.c: In function ‘ngx_http_set_virtual_server’:
src/http/ngx_http_request.c:2109:32: error: ‘cscf’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
已成功使用了--with-jemalloc=/path/to/jemalloc/source/dir
編譯,但如何知道已使用中?
Can latest lua-nginx-module be merged into tengine mainline?
当用proxy反代的时候ngx_http_footer_filter_module使用这个模块的时候,Chrome浏览器能出来底部信息,但是其他浏览出不来
我的后端服务器使用动态域名,当动态域名的地址变了之后就会不断出现以下错误:
2013/03/23 16:27:37 [error] 21253#0: check time out with peer: 113.96.37.249:60080
2013/03/23 16:27:37 [error] 21257#0: check time out with peer: 113.96.37.249:60080
2013/03/23 16:27:43 [error] 21253#0: check time out with peer: 113.96.37.249:60080
2013/03/23 16:27:43 [error] 21257#0: check time out with peer: 113.96.37.249:60080
2013/03/23 16:27:49 [error] 21253#0: check time out with peer: 113.96.37.249:60080
并且只有重启tengine之后才能解决。
我的配置如下:
upstream mygroup {
server server1.dynamic.dns:60080;
server server2.dynamic.dns:60080;
check interval=3000 rise=2 fall=2 timeout=3000 type=http;
check_http_send "GET /upstream_check HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx;
}
当然即使不用动态域名,后端服务器域名解析也有可能变动,建议tengine能够定时更新域名解析。
在使用tengine时遇到了对cacti及zabbix监控模板的不支持的情况。建议tengine开发相关管理工具的模板,以便增加对tengine输出request_time的监控!多谢!祝tengine项目越来越牛!
src/os/unix/ngx_sysinfo.c break the build, undef NGX_HAVE_GETLOADAVG NGX_HAVE_SYSINFO in objs/ngx_auto_config.h to make it work.
please use an alternate method to check for the support of those functions (sysinfo, getloadavg), they have different definition on solaris machines. should only enable it with supported platform.
求编译一个Windows版本
出错配置如下,
upstream ocdna {
server 112.125.239.95;
}
server {
listen 80;
server_name www.wiz.cn;
location @__httpmanager_origin {
proxy_pass http://ocdna;
}
location / {
error_page 404 = /__httpmanager_origin ;
error_page 451 = @__httpmanager_origin ;
#lua_check_client_abort on;
content_by_lua '
httpmanager:add_cache_rule({base_cache=true, time=60})
httpmanager:add_cache_rule({file_ext="jpg|gif|png|css",static=true,time=60})
httpmanager:add_cache_rule({file_ext="jpg|gif|png",nocache=true})
httpmanager:add_cache_rule({url="download.html",static=true,time=5,regex=false})
httpmanager:run()';
}
location /__httpmanager_origin {
internal;
rewrite ^/__httpmanager_origin(.*)$ $1 break;
proxy_pass http://ocdna;
proxy_set_header Cache-Control no-cache;
proxy_set_header Pragma no-cache;
}
当去掉
proxy_set_header Cache-Control no-cache;
proxy_set_header Pragma no-cache;
example:
server {
server_name 1;
access_log /tmp/tengine_a main buffer=32k;
}
server {
server_name 2;
access_log /tmp/tengine_a main buffer=64k;
}
nginx: [emerg] access_log "/tmp/tengine_a" already defined with conflicting parameters in /root/nginx.conf:38
configuration file /root/nginx.conf test failed
请教这次新更新的tengine是和nginx1.5代码有关系吗。版本名称是否有关联?
另外编译后的文件大小有所增加,是否有新的模块引入
使用Cgwin编译的 Tengine,运行一段时间 出现 [alert] 5380#0: accept4() failed (22: Invalid argument) 后自动停止运行了。
是不是编译的时候少了什么模块。
Hello.
Hardly looking for a way to count current visitors. The main aim is to know current visitors (at least with delay of 30 sec) on per domain or subdomain basis. For example we have domain1.com and domain2.com, we need to know exact numbers of visitors currently for domain1.com and domain2.com. As i know, currently there are no way to know number of current visitors. Maybe - there should be additional option in nginx_status like 'status?full' or similar separate func? I understand, that we can use external systems to know these numbers, but they'll have a delay. Logging is not correct way while number of visitors too high. I need a visitors number to make some actions, for example to enable additional external protection or anything else with domain/subdomain.
求教这两个模块是否支持基于proxy返回的内容进行处理。
···
proxy_next_retries 2;
upstream u{
server a.b.c.1:8400;
server a.b.c.2:8400;
server a.b.c.3:8400;
server a.b.c.4:8400;
server a.b.c.5:8400;
server a.b.c.6:8400 backup;
}
location / {
proxy_pass http://u;
}
···
故障现象:
该指令在#322 中被引入Tengine,我们使用的1.5.1版本tarball和github上 e0d384e 确认有此问题
能否把ngx_http_limit_req_module
独立出来,使其支持官方版本?
Hello,
I just tried the trim module with nginx-echo module to test few cases. I am not sure how it works but when there are more number of space " " characters, it just replaces the word after the spaces on page refresh.
Test case:
location /htmlTest {
default_type text/html;
echo "";
echo "hello Moki\n\n\n";
echo "2nd line";
echo "";
echo "";
echo "";
echo "3rd linetest"; #Long space before "linetest" word.
echo "last line";
trim on;
}
Result (first time page reload):
We get first line blank and all contents in second line
1
2 hello Moki 2nd line 3rd linetest last line
Result (After reloading page 8-10 times, we get final result like below) :
1 hello Moki
2 2nd line 3rd linetest linetest linetest linetest linetest linetest linetest linetest linetest linetest linetest linetest linetest linetestinetest last line
It would be good if someone can look into this because it seems to be major bug.
Thanks,
Makailol
仅仅对用户写的模块进行动态编译,结果发现用户自定义的指令没有被识别。
比如:
Starting nginx: nginx: [emerg] unknown directive "xxxxxx" in /usr/local/nginx/etc/nginx.conf:60
error ...
但如果对用户的模块进行静态编译,运行nginx却没有上述问题
是不是dso编译的时候需要注意点啥?
Hi,
https://github.com/alibaba/tengine/blob/master/conf/nginx.conf
Because it's tengine. should we change the name to tengine.conf?
Thanks.
I would like to point out that identifiers like "_NGINX_H_INCLUDED_
" and "_NGX_HTTP_H_INCLUDED_
" do not fit to the expected naming convention of the C language standard.
Would you like to adjust your selection for unique names?
nginx.conf的http段配置如下
limit_req_zone $binary_remote_addr zone=req:20m rate=100r/s;
limit_req zone=req burst=150;
然后开始压力测试,得到如下结果
[root@nginx tengine-1.4.0]# grep '21/Sep/2012:11:05:44' /data/logs/access.log |grep 200|wc -l
100
[root@nginx tengine-1.4.0]# grep '21/Sep/2012:11:05:45' /data/logs/access.log |grep 200|wc -l
100
[root@nginx tengine-1.4.0]# grep '21/Sep/2012:11:05:46' /data/logs/access.log |grep 200|wc -l
100
请问,burst参数的效果在哪里
nginx: [emerg] unknown "request_time_msec" variable
It looks strange as far as this variable described in documentation. I've used it this way:
footer "";
What am i doing wrong?
同一份脚本(cases/concat.t ),在不同的机器,却发生了不同的反应
在我开发机器:
[root@xxx nginx-tests]# TEST_NGINX_BINARY=/home/wangbin/work/research/tengine/objs/nginx TEST_NGINX_LEAVE=1 prove cases/concat.t
cases/concat....ok 119/169Undefined subroutine &IO::Uncompress::Gunzip::gunzip called at lib/Test/Nginx.pm line 487.
Looks like you planned 169 tests but ran 119.
cases/concat....dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 120-169
Failed 50/169 tests, 70.41% okay (less 1 skipped test: 118 okay, 69.82%)
cases/concat.t 255 65280 169 100 59.17% 120-169
1 subtest skipped.
Failed 1/1 test scripts, 0.00% okay. 50/169 subtests failed, 70.41% okay.
error.log报:
2012/09/29 11:36:05 [error] 2828#0: *1 client sent too many concat filenames, client: 127.0.0.1, server:
localhost, request: "GET /concatFile/??hello.js,world.js,jack.js,t1.js,t2.js,t3.js,t4.js,t5.js,t6.js,t7
.js,t8.js,t9.js,t10.js,t11.js,t12.js,t13.js,t14.js,t15.js HTTP/1.0", host: "localhost"
同样的脚本到了另外一台机器:
[root@bgp176-148 nginx-tests]# TEST_NGINX_BINARY=/home/wangbin/work/tengine/objs/nginx TEST_NGINX_LEAVE=1 prove cases/concat.t
cases/concat....ok
All tests successful.
Files=1, Tests=169, 6 wallclock secs ( 0.72 cusr + 0.55 csys = 1.27 CPU)
请问需要设置啥,才能测试都通过?
Hello all.
The web should be faster than it is. Pagespeed is one the helpers. But on busy server's it can not be used with current features. It requires memory cache and min_uses feature. I suggested it here: apache/incubator-pagespeed-ngx#182
But i assume nginx's cache would not work if it will not be forked onto main code. So only tengine can help here.
Can Pagespeed be a native static module on Tengine, which is not ON by default and all who want it - can add needed line in ./configure string?
Thanks in advance,
Alex.
limit_req_whitelist bug
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=2r/s;
geo $white_ip {
ranges;
default 0;
58.166.39.182-58.166.39.184 1;
58.112.221.179-58.112.221.190 1;
121.130.163.153-121.130.163.154 1;
}
limit_req_whitelist geo_var_name=white_ip geo_var_value=1;
limit_req_zone $binary_remote_addr zone=white_ip:100m rate=2r/s;
include /usr/local/webserver/nginx/conf/vhosts/*.conf;
}
location ~*^/(home|IndexAction.class|message_check|index).php$ {
root /htdoc/hao123/xk.hao123.com/;
limit_conn conn_limit_per_ip 3;
limit_req zone=white_ip burst=4 nodelay;
limit_req_whitelist geo_var_name=white_ip geo_var_value=1;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
58.166.39.182-58.166.39.184 this whitelist ip request http://xk.hao123.com/ limit ,bug,help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.